4 Replies Latest reply on Nov 7, 2012 7:23 AM by philmodjunk

    Populating email address fields with multiple addresses



      Populating email address fields with multiple addresses


           I am trying to figure out how I can populate the To:, Cc:, or Bcc: fields with multiple emails based on a criteria.  The basic design is like this.

           3 tables:

           Discipline - Basic table with a discipline (Nuclear Engineering, Mechanical Engineering, Materials Science etc.) each with a unique id.

           Contacts - Obviously contains the email address and other information for each person along with a unique id.  In this table you select a discipline for each person from a pop-up menu using a value list populated by the Discipline table.

           Email - This table contains your basic email information.  I already have everything set up so that if I manually enter addresses and messages I can click a button that says Send Mail and FileMaker exports the information to the appropriate fields in my email client.  This works perfectly.

           What I would like to do is create a button for the To:, Cc:, and Bcc: fields that will automatically populate these fields with email addresses related to the selected discipline (this is also populated by the Discipline table).  In theory, if you have Materials Science selected as below and you press the Bcc: button, I want FileMaker to automatically insert all of the email addresses associated to Materials Science in the Bcc:.  The same thing would happen with To: and Cc:.

           Thanks in advance!


           FMP 12 Advanced

           Windows 7



        • 1. Re: Populating email address fields with multiple addresses

               Sending with email client, SMTP server, webmail, or plugin??

               #Perform a find to find all the records that contain an email address to which you plan to send the email
               Go To Record [First]
                 #In the next step change ; to , if you need to use that delimitter for your email software
                 Set Variable [$EmailList; Value: $EmailList & "; " & YourTable::YourEmailField]
                 Go To Record [next; exit after last]
               End Loop
               Set Field [YourTable::YourGlobalSendField; Right($EmailList; Length($EmailList) - 2 /* strip off the leading "; " */]
               #Now you can use YourTable::YourGlobalSendField as your specified field to send out your email

          "Conventional Wisdom"

               However, to send one email using the recipients represented by all records in the found set,
               you would have to have your script loop through all records and store the list of emails to a local variable or
               to a global field, and then send the email using the 'one email' option and using that variable or global as your recipient.


          Home > Sharing data > Saving, importing, and exporting data > Sending email messages based on record data > Sending one email message

          Home > Sharing data > Saving, importing, and exporting data > Sending email messages based on record data >
          Entering or editing SMTP options

          The FileMaker Send Mail Script Step  February 17, 2012

          Sending HTML Email from FileMaker  Posted by donovan11/02/2012   Demo databases available

          2010  Filemaker Email Plugins Compared

               Email Client Popularity

                                                   35.6% iOS Devices                                          20.14% Outlook                                          13.57% Hotmail
                                                   11% Apple Mail                                          9.85% Yahoo! Mail                                          8.43% Gmail
                                                   4.74% Android                                          2.34% Windows Live Desktop                                          1.03% Thunderbird
                                                   0.79% AOL Mail


          1 of 1 people found this helpful
          • 2. Re: Populating email address fields with multiple addresses

                 There are at least two ways that you can do this.

                 But how do you link your three tables in relationships? Can the same contact be linked to more than one Discipline?

                 An email address can be a field in contacts, so what is the purpose of your separate email table, to document all details of a particular email message?

            • 3. Re: Populating email address fields with multiple addresses

                   The contacts only have one discipline.  The tables are linked by discipline id.

                   The purpose of the email table is to allow a user to craft a message, select a group (by discipline) for each of the address fields needed and press send.  The email is being sent via email client simply because it's the easiest solution, I may go the smtp route in the future.  Once the email, with all necessary information is exported to the email client, I will then have a record for each email sent out.  If there are any questions about a particular email in the future, this will save me from having to remember who sent the email, find out if they saved it, etc. since I can find everything I need in one place.

              • 4. Re: Populating email address fields with multiple addresses

                     I gather that the list of email addresses can be different for each email address box in your Send Mail dialog. If they were the same, you could pull up a found set of contacts and use the "multiple addresses-every address in found set" option.

                     You'll need to check and see whether a list of email addresses uses a comma or a semi-colon between individual email addresses. I will assume a semi-colon in this example.

                     Define 3 DisciplineID fields in your email table: ToDiscID, BCCDiscID and CCDiscID. Link your emails table to 3 separate occurrences of your contacts table by each of these fields to the disciplineID field in contacts. Format them with value lists on your layout so that you can select a discipline by name and enter the ID number for it.

                     This would give you:

                     Emails::ToDiscID = ToContacts::DisciplineID
                     Emails::BCCDiscID = BCCContacts::DisciplineID
                     Emails::CCDiscID = CCContacts::DisciplineID

                     Then you can use this calculation to specify a list of email addresses for the To box in Send Mail:

                     Substitute ( List ( ToContacts::EmailAddress ) ; ¶ ; ";" )

                     Similar expressions referring to the EmailAddress field in each of the other two table occurrences will serve for the CC and BCC fields.