3 Replies Latest reply on Mar 3, 2014 11:52 AM by mikebeargie

    Multiple emails with attachment

    logoknife@aol.com

      I am trying to send emails to all clients with attached invoice. I can't figure out how to send multiple emails at a time with their invoice attached. Any ideas?

        • 1. Re: Multiple emails with attachment
          mikebeargie

          Are you referring to sending a single invoice to multiple email addresses? Or multiple invoices to separate email addresses?

           

          In the former, you need to build your email address list.

           

          In the latter, you need to place your send mail script step in a loop that will loop through all invoices and send out an email for each invoice.

          • 2. Re: Multiple emails with attachment
            logoknife@aol.com

            Multiple invoices to separate email addresses.

             

            I like you answer, but do not know how to do that. Is there a video or steps to take to do that?

             

            I have seach but not sure what to search and have not found that answer.

            • 3. Re: Multiple emails with attachment
              mikebeargie

              Looping is a basic concept of any development language, here's a link to a brief explanation:

              http://www.filemaker.com/help/html/create_script.12.33.html

               

              Most likely it's covered in the FileMaker training series, which I'd suggest reading through and understanding before attempting any development that has financial interests in mind (IE invoicing).

               

              Your script would look something like this:

               

              Go To Layout (invoices)

              Perform find (script step to find the current set of invoices)

              Go To Record/Request/Page – First (to go to the first record in your found set)

              Loop

                 Set variable - $path - "file:" & get(temporary path) & invoices::invoicenumber & ".pdf" (this is a path to temporarily save your invoice PDF)

                 save records as pdf – current record – save to $path as location

                 Send email – to InvoiceCustomer::emailaddress (so from your related customer table, pull the related email address you're sending it to). Add $path as an attachment (to attach the PDF you just saved as an attachment).

                 Go To Record/Request/Page – Next – check "exit after last" (repeats action and exits after the last record in your found set)

              End Loop

               

              Looping through send emails can get spammy/dangerous easily, so you should thoroughly test this on a small set of sample emails and work out any bugs.