4 Replies Latest reply on Jun 10, 2015 9:49 AM by philmodjunk

    Using Send Mail to send one email for each record to email address in that record.

    larryw

      Title

      Using Send Mail to send one email for each record to email address in that record.

      Post

      Send Mail is not performing as expected. The simple scenario is in a two-field test table, each record in the found set contains an email address to where the email must be sent, and a second field contains the email body. Send Mail is configured to use the SMTP server feature. The table contains 4 records. 

      When "One email using data from the current record" is checked, each email address (one per row) has emails from each other records sent to it. When the "multiple emails (one for each record in found set)" is checked, each email gets each other addresses emails. 

      This scenario is too easy for it not to work. What I simply want is one and only one email going to one email address, for each record, and no emails sent to anyone else. 

      What am I doing wrong or not understanding.

        • 1. Re: Using Send Mail to send one email for each record to email address in that record.
          philmodjunk

          I suggest describing what you are doing in this test in more detail. We need to also know exactly what you are specifying in the "TO" box of the Send Mail dialog.

          • 2. Re: Using Send Mail to send one email for each record to email address in that record.
            larryw

            In a newly created Filemaker file, the table is called SendMailList with two text fields: email, name and for testing two rows.

            Email field contains an email address, and name field contains a name that would be rendered in the body as "Hello, <name>".

            Script is in the screen image uploaded to this answer. Three email accounts are involved: my Yahoo account, my iCloud account, and my Gmail account. In Mail, the Yahoo account is chosen so it becomes the default "sending" account. The table contains two rows: field email contains the gmail address in row one, the iCloud address in row two. The script is executed via a button on a list layout of the SendMailList table. For each row, a draft email message pops up. That is, there are two email messages drafted, one for each row. The TO: field contains the expected value in the email field of each row. In response to each of the two draft email messages, I send the message. The result is both the iCloud and the Gmail accounts receive BOTH emails, though the draft emails contained no reference to the other email address. 

            My expectation and the scenario I wanted executed is the specific email generated for a particular email address is sent to only that email address. 

            • 3. Re: Using Send Mail to send one email for each record to email address in that record.
              larryw

               

              There is probably nothing wrong with Filemaker. After spending a half-a-day more further testing, it seems that the problem is isolated to my email addresses themselves. There must be some mail.app or external linkages among my 5 email accounts that are causing the problem. Sending tests cases to a few other folks' emails does not replicate the problems I see with my accounts.

               

              • 4. Re: Using Send Mail to send one email for each record to email address in that record.
                philmodjunk

                What I do see in your script is a loop that executes the send mail step step once for each record in your table. You definitely would NOT use such a looping script with the "Send to found set" option or you will send out multiple emails to each recipient.