10 Replies Latest reply on Mar 1, 2016 1:49 PM by klasicecream

    Intermittent SMTP Email Errors

    klasicecream

      Hi all,

       

      Longtime lurker, finally made an account as I have an issue that I cannot seem to solve. I am looking forward to joining the community! I am relatively new to Filemaker development, mostly managing my organization's solution.

       

      I am trying to switch our email scripts from "Send via Email Client" to "Send via SMTP Server", to reduce busywork for my colleagues. I have it running as a test on one of our scripts, and while it works sometimes, occasionally I get error 1506 and half of a batch (or more) simply doesn't send.

       

      In this last instance a colleague tried to send an email to a batch of 33 clients. It sent successfully to the first 9 records, and then the last 24 all received Error 1506 (Emails not sent successfullly). I checked the SMTP logs and there is no mention of a FM connnection past the 9th client - it's as if FM lost connectivity to postfix and was not able to process any further emails. The question is, why? It's extremely difficult to diagnose this without any information in the logs, or anything in Filemaker other than the useless Error 1506.

       

      I've attached the section of the script that sends the email for your perusal - the "Pause 5 seconds" was added in because in an earlier attempt to solve this issue, we saw from the logs that we had received a vacation autoresponse on one of the emails, and the next two records encountered errors. We thought that perhaps giving FM some time in between sending would help increase the likelihood of a successful send.

       

      Might anyone know: Does FMS attempt to authenticate before sending each message or does it work on a batch basis? Given the looping nature of the script I'm inclined to say that it authenticates before sending each message but I'm not 100% sure.

       

      Any insight you might have would be extremely appreciated!

       

      A few notes...

      - We have an email validation script running that checks all of the emails before sending, so we know that there is not an issue with the email addresses of those not sending. In this case I also visually inspected the email addresses and saw nothing of note. We've sent to them in the past out of Mac Mail without issue.

      - We are using our in-house OS X server for email and do not have any other issues with it.

      - We are running FMS 13 on Mac OS X Server.

       

      Many thanks,

      Kaitlyn

        • 1. Re: Intermittent SMTP Email Errors
          TorstenBernhard

          try with the pause step after the send email step

          • 2. Re: Intermittent SMTP Email Errors
            siplus

            it might help to have 2 scripts, one that cycles through the clients and one called by it, via parameters, which actually sends a mail.

            • 3. Re: Intermittent SMTP Email Errors

              I agree that FileMaker's "errors" aren't usually that useful to fixing the problem. But, you can deduce things by experimentation.

               

              Idea 1:

              Why don't you try to send all however many emails to a single address you know is working. See if that works.

               

              Idea 2:

              If doesn't work, I would write a Java Mail program to do the exact SMTP send to all the recipients. That is, something different to test the SMTP server itself independent of FMP. If that doesn't work, you know it's SMTP somehow.  You don't have to use Java, but the idea is any separate "environment" where you can hit the SMTP server with a batch of email addresses (possibly all the same one for testing) to see what happens and gather data.

               

              Idea 3:

              Also, how about trying to do the send on a local standalone copy of FMP so you can take the FMS out of the equation?

               

              Given enough testing, you should be able to draw some good conclusions.

               

              Famous programmers' method: Divide and Conquer.

               

              HTH

               

              - m

              • 4. Re: Intermittent SMTP Email Errors
                klasicecream

                Hi Torsten,

                 

                Thanks for the response!

                 

                I thought about perhaps putting this script step after, but as it is a loop this really shouldn't make a difference except to the last email in the found set. Are you thinking that FM needs a break specifically between the send email command and the set field command?

                 

                Thanks,

                Kaitlyn

                • 5. Re: Intermittent SMTP Email Errors
                  klasicecream

                  Hi Siplus,

                   

                  Thanks for responding!

                   

                  How would factoring out the email into a separate script help?

                   

                  Thanks,

                  Kaitlyn

                  • 6. Re: Intermittent SMTP Email Errors
                    klasicecream

                    Hi Morkus,

                     

                    Thanks for responding!

                     

                    The problem is that the issue is intermittent - I can send an email via SMTP today with no issue to a group where I encountered an issue last week, or vice versa.

                     

                    - I've run tests on a group of records with absolutely no issue, so I have tried Idea #1.

                     

                    - We send out hundreds of emails via mac mail on this SMTP server (sometimes in 100 email batches or more) so we know it isn't the issue. The issue is constrained to sending out of FM.

                     

                    - While we are running FMS, the actual script is being run manually using FM, it isn't a scheduled script on FMS.

                     

                    How do we test and form any conclusions when it works one time and not another, on the same data set?

                     

                    Thanks,

                    Kaitlyn

                    • 7. Re: Intermittent SMTP Email Errors
                      TorstenBernhard

                      Hi Kaitlyn

                      I've put it this way and it worked for me.

                       

                      This thread may give you more information about the topic:

                      https://community.filemaker.com/message/473466#473466

                       

                      Regards

                      Torsten

                      • 8. Re: Intermittent SMTP Email Errors

                        From my reply above, I would try to bring your FMP application locally to take FMS out of the equation.


                        Try to run the email send locally, perhaps with just a couple known good email addresses.

                         

                        ---

                         

                        It could very well be a server issue, so if the local FMP works OK, then I'd try FMS on another platform. If that other FMS platform works (say, Windows Server instead of Mac Server)  then you know it's a server issue (probably), not an FMS issue.

                         

                        Once you can identify exactly where the issue is, it will be much easier to fix.

                         

                        ----

                         

                        Remember that the computer is stupid. It can only give you simple error information back so remember when your computer instructor possibly asked you to create a guessing game?  To get to a guess quickly, you had to divide the problem space or you'd be guessing all day long.

                         

                        Here's a simple example of what I was suggesting you do, though not a guessing game, to narrow down what's going on:

                         

                        Type 'ready' to start or 'yes' or 'end' to quit

                        I'm assuming your number is between 1 and 1000

                         

                        ready

                         

                        ***************** Is the number you're thinking of: 500? ***************

                         

                        lower

                         

                        ***************** Is the number you're thinking of: 250? ***************

                         

                         

                        --------------------------------------------------------------

                        Commands I understand are: 'higher', 'lower', 'yes', and 'end')

                        ('yes' means I found your number and 'end' means you want to quit.)

                         

                        lower

                         

                        ***************** Is the number you're thinking of: 125? ***************

                         

                         

                        --------------------------------------------------------------

                        Commands I understand are: 'higher', 'lower', 'yes', and 'end')

                        ('yes' means I found your number and 'end' means you want to quit.)

                         

                        higher

                         

                        ***************** Is the number you're thinking of: 187? ***************

                         

                         

                        --------------------------------------------------------------

                        Commands I understand are: 'higher', 'lower', 'yes', and 'end')

                        ('yes' means I found your number and 'end' means you want to quit.)

                         

                        lower

                         

                        ***************** Is the number you're thinking of: 156? ***************

                         

                         

                        --------------------------------------------------------------

                        Commands I understand are: 'higher', 'lower', 'yes', and 'end')

                        ('yes' means I found your number and 'end' means you want to quit.)

                         

                        higher

                         

                        ***************** Is the number you're thinking of: 171? ***************

                         

                         

                        --------------------------------------------------------------

                        Commands I understand are: 'higher', 'lower', 'yes', and 'end')

                        ('yes' means I found your number and 'end' means you want to quit.)

                         

                        higher

                         

                        ***************** Is the number you're thinking of: 179? ***************

                         

                         

                        --------------------------------------------------------------

                        Commands I understand are: 'higher', 'lower', 'yes', and 'end')

                        ('yes' means I found your number and 'end' means you want to quit.)

                         

                        lower

                         

                        ***************** Is the number you're thinking of: 175? ***************

                         

                         

                        --------------------------------------------------------------

                        Commands I understand are: 'higher', 'lower', 'yes', and 'end')

                        ('yes' means I found your number and 'end' means you want to quit.)

                         

                        yes

                         

                        *******  bye, hope to see you again soon!

                         

                        - m

                        • 9. Re: Intermittent SMTP Email Errors
                          siplus

                          technically you are creating a stack of scripts to be executed as opposed to a stack of instructions.

                          • 10. Re: Intermittent SMTP Email Errors
                            klasicecream

                            Hi all,

                             

                            Did some further testing and was able to determine a pattern! The email sends perfectly to the first 9 records in the found set, then spits our errors for the remainder of the found set.

                             

                            So the test that I ran went like this:

                             

                            - Send to 33 records in found set: First 9 sent successfully, then 24 errors.

                            - Create found set of 24 error records. Send to all 24 records: First 9 sent successfully, then 15 errors.

                            - Create found set of 15 error records. Send to all 15 records. First 9 sent successfully, then 6 errors.

                            - Create found set of 6 error records, send to all 6 records successfully.

                             

                            I can't identify anything in the scripting that would explain this, but will try moving the pause in the script directly after the sending as suggested by , factoring out the email portion of the script to another script à la , and recreating the script in a new database to test it out as recommended by