13 Replies Latest reply on Dec 3, 2015 10:02 AM by TSGal

    Send Mail (SMTP) doesn't wait long enough for server response

    ehall

      Summary

      Send Mail (SMTP) doesn't wait long enough for server response

      Product

      FileMaker Pro

      Version

      11.0v4

      Operating system version

      OS X 10.6.8 (Snow Leopard)

      Description of the issue

      When using the Send Mail script step to send email to an SMTP server, FileMaker sometimes returns a 1506 error, even though the email sent successfully.  This makes it impossible to handle errors, because we have no way of knowing whether a 1506 error is accurate or not.

      Steps to reproduce the problem

      Here is an example script that sends 20 emails to an SMTP server.  Try it on a slow SMTP server, or maybe try adding a large attachment.  If the server takes more than 5-10 seconds to process the email, FileMaker will return a 1506 error, even if the email is sent successfully.

      I've attached a screenshot of the results from one test run.  Three of the illustrated attempts returned 1506 errors, even though two of those three were received successfully.

      Set Error Capture [ On ]
      Set Variable [ $max; Value:20 ] Loop
      Set Variable [ $count; Value:$count + 1 ]
      Set Variable [ $startTime; Value:Get ( CurrentTimeStamp ) ]
      Send Mail [ Send via SMTP Server; To: "ehall@fantasyflightgames.com"; Subject: "Test email " & $count & " - " & Get(CurrentTimeStamp); Message: "Test email " & $count & " - " & Get(CurrentTimeStamp); Name: "FM Mail Test"; Email Address: "example@aaa.com"; SMTP Server: "mail.aaa.com"; Port: 25; Authentication Type: None ] [ No dialog ]
      Set Variable [ $sendResults; Value:Let ( [ sendError = Get ( LastError ) ;
      endTime = Get ( CurrentTimeStamp ) ; duration = endTime - $startTime ; logLine = sendError & " " & duration & "     " & $startTime & " " & endTime
      ];
      $sendResults & logLine & ¶
      )]
      Exit Loop If [ $count ≥ $max ]

      Expected result

      FileMaker should not return an error if the email is sent successfully.  In this case, that may mean waiting longer for a response from the server.

      Actual result

      Occasional 1506 error, even if the email sends successfully.

      Exact text of any error message(s) that appear

      "Email(s) could not be sent successfully."

      Configuration information

      The SMTP server I'm connecting to runs OS X Server 10.6.8.  Here is a snippet from the /var/log/mail.log file that shows two example emails.  Both were sent successfully, but the first returned an error in FileMaker.

      I attempted to remove identifying information from these logs.  Let me know if you need more information to research the issue.


      ## error 1506, but actually sent ok

      Feb 29 13:57:23 edoras postfix/smtpd[79849]: 0E65138F6067: client=unknown[nn.nn.nn.nn]
      Feb 29 13:57:23 edoras postfix/cleanup[77035]: 0E65138F6067: message-id=
      Feb 29 13:57:50 edoras postfix/qmgr[42184]: 0E65138F6067: from=, size=159944, nrcpt=2 (queue active)
      Feb 29 13:58:21 edoras postfix/smtp[77282]: 0E65138F6067: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=58, delays=28/0.08/0/31, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=79165-12, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as C628D38F60D8)
      Feb 29 13:58:21 edoras postfix/smtp[77282]: 0E65138F6067: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=58, delays=28/0.08/0/31, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=79165-12, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as C628D38F60D8)
      Feb 29 13:58:21 edoras postfix/qmgr[42184]: 0E65138F6067: removed

      Feb 29 13:58:15 edoras postfix/smtpd[77822]: C628D38F60D8: client=localhost[127.0.0.1]
      Feb 29 13:58:15 edoras postfix/cleanup[77696]: C628D38F60D8: message-id=
      Feb 29 13:58:21 edoras postfix/qmgr[42184]: C628D38F60D8: from=, size=160316, nrcpt=2 (queue active)
      Feb 29 13:58:25 edoras postfix/pipe[79251]: C628D38F60D8: to=, relay=dovecot, delay=9.5, delays=5.7/0.46/0/3.4, dsn=2.0.0, status=sent (delivered via dovecot service)
      Feb 29 13:58:33 edoras postfix/smtp[79322]: C628D38F60D8: to=, relay=mail.bbb.com[mm.mm.mm.mm]:25, delay=18, delays=5.7/0.35/11/1.5, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 88D196DC120)
      Feb 29 13:58:33 edoras postfix/qmgr[42184]: C628D38F60D8: removed


      ## no error, sent ok

      Feb 29 14:03:34 edoras postfix/smtpd[80408]: BB92B38F6457: client=unknown[nn.nn.nn.nn]
      Feb 29 14:03:34 edoras postfix/cleanup[80355]: BB92B38F6457: message-id=
      Feb 29 14:03:36 edoras postfix/qmgr[42184]: BB92B38F6457: from=, size=159960, nrcpt=2 (queue active)
      Feb 29 14:03:54 edoras postfix/smtp[80241]: BB92B38F6457: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=19, delays=1.8/0/0/18, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=79165-19, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 750E538F64AD)
      Feb 29 14:03:54 edoras postfix/smtp[80241]: BB92B38F6457: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=19, delays=1.8/0/0/18, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=79165-19, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 750E538F64AD)
      Feb 29 14:03:54 edoras postfix/qmgr[42184]: BB92B38F6457: removed

      Feb 29 14:03:53 edoras postfix/smtpd[80308]: 750E538F64AD: client=localhost[127.0.0.1]
      Feb 29 14:03:53 edoras postfix/cleanup[80429]: 750E538F64AD: message-id=
      Feb 29 14:03:54 edoras postfix/qmgr[42184]: 750E538F64AD: from=, size=160332, nrcpt=2 (queue active)
      Feb 29 14:03:55 edoras postfix/pipe[80152]: 750E538F64AD: to=, relay=dovecot, delay=2, delays=1/0.32/0/0.69, dsn=2.0.0, status=sent (delivered via dovecot service)
      Feb 29 14:04:09 edoras postfix/smtp[80400]: 750E538F64AD: to=, relay=mail.bbb.com[mm.mm.mm.mm]:25, delay=17, delays=1/0/14/1.1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 773AB84006)
      Feb 29 14:04:09 edoras postfix/qmgr[42184]: 750E538F64AD: removed

      script_output.png

        • 1. Re: Send Mail (SMTP) doesn't wait long enough for server response
          TSGal

          ehall:

          Thank you for your post.

          Error 1506 is a generic error message that the emails could not be sent successfully.  This usually occurs when we do not receive confirmation back from the SMTP Server, and in many of those instances, the email has been sent successfully.  We are seeing this more often when sending through gmail server.

          Another user has reported that if only the email address is sent and not the name, the error 1506 does not occur.

          One customer put a Pause/Resume 1 second script step between sending of emails (in case of too many emails being queued up), and the number of error 1506 messages diminished sharply.

          Let me know if any of the above workarounds help.

          TSGal
          FileMaker, Inc.

          • 2. Re: Send Mail (SMTP) doesn't wait long enough for server response
            ehall

            Thank you for the response.

            Unfortunately (fortunately?), our mail server is responding much faster, now, after some network changes.  The "false error" still happens when the server is under heavy load, but not as regularly as before. The problem is definitely still there, but it's harder to test for.

            I'll run some tests with the changes you suggested and see if I get any conclusive results.

            • 3. Re: Send Mail (SMTP) doesn't wait long enough for server response
              ehall

              I removed the Sender Name and added a 1 second delay before sending each email, but it didn't seem to affect the number of false 1506 errors.  Regardless of these settings, I've been seeing one or two errors for every 20 or so attempted emails.  In all these cases, the email was sent successfully despite the error.

              Can you tell me what timeout limit FileMaker uses for a Send Mail connection?  If I knew when FileMaker was giving up on a connection, I might be able to adjust our STMP server to accomodate this.

              • 4. Re: Send Mail (SMTP) doesn't wait long enough for server response
                TSGal

                ehall:

                Thanks for the additional information.

                The timeout limit FileMaker uses is 5 seconds.  The normal timeout is longer (30 seconds for Windows, unsure for Mac), and Testing believed this OS timeout was much too long to wait for a response, so 5 seconds is used.  Naturally, if you have a large attachment, this could take longer than 5 seconds to process, so consider sending smaller files (if possible).  Another option would be to create a temporary email account where you could use in the BCC.  I know this would fill up the Inbox if you send a large number of emails in batch, but you could count the emails sent with the emails received in the temporary account to see if the timeout errors are legitimate.

                If I could get the following information, I will send it to Testing for additional review:

                1. The email server being used.
                2. What authentication is being used (plain, CRAM-MD5, etc...)
                3. Do you have any problems using an email client?

                Any other information you can provide may be helpful.

                TSGal
                FileMaker, Inc.

                • 5. Re: Send Mail (SMTP) doesn't wait long enough for server response
                  ehall

                  The emails that we're sending do include attachments, but the average attachment size is only about 100 kb.  I don't know that we can reduce them much more.

                  We are using a BCC address right now to double-check whether timed-out emails were sent, but I would rather not rely on this as a long-term solution.

                  1. We are using Mac OS X Server 10.6.8 for our mail server.
                  2. No authentication. (For senders inside our local network, SMTP authentication is not required.)
                  3. I'm not aware of any issues sending mail from email clients.

                  Thank you for looking into this.

                  • 6. Re: Send Mail (SMTP) doesn't wait long enough for server response
                    TSGal

                    ehall:

                    Thanks for the additional information.  I have sent this entire thread to our Testing department for additional review and feedback.  When information becomes available, I will let you know.

                    TSGal
                    FileMaker, Inc.

                    • 7. Re: Send Mail (SMTP) doesn't wait long enough for server response
                      dantaylornz

                           I am experiencing this issue using Filemaker Pro 12.0v4 and Filemaker Go 12.0v04 (on iPad 3) to send mail via SMTP. I am connecting over SSL to a smtp.gmail.com and I am convinced that the reason I am receiving the 1506 error is due to a short timeout on a slow network connection. Attempting a send mail command using the same paramters over and over will eventually result in a successful send. Sometime an email is sent even though Filemaker reports error 1506. This is a major issue which undermines the integrity of transactional email sent from Filemaker.

                           In my case I am attaching a PDF between 100-120KB in size which isn't large, but by the time authentication completes with GMail and the attachment is uploaded over a slow network it could very easily take 10 seconds or more.

                           I am frustrated to be experiencing this issue with no real communication from Filemaker about a solution or any workarounds. In my mind the best solution would be to make it possible to adjust server timeout in the Send Mail script step. This means the user could determine an appropriate timeout based on the size of any attachment and network performance.

                           Could someone from Filemaker please comment on what has been done about this problem and what solutions are planned to address this?

                      • 8. Re: Send Mail (SMTP) doesn't wait long enough for server response
                        dantaylornz

                             I note, by the way, that GMail recommend a timeout of at least 1 minute when connecting to their servers. See https://support.google.com/mail/troubleshooter/1668960?rd=1#ts=1665119,1665157,2769079

                        • 9. Re: Send Mail (SMTP) doesn't wait long enough for server response
                          tomasd

                               We have this issue too. Sometimes was email send and Filemaker still displayed warning about error 1506.

                               Currently we are using ScriptMaster and custom function through java mail api and it works fine.

                          • 10. Re: Send Mail (SMTP) doesn't wait long enough for server response
                            Chris Irvine

                            This is still a significant issue. If FileMaker's opinion is that a 5 second timeout is appropriate, then you are going to have to give us a way to override and increase this.

                             

                            If you check RFC 2821, you will find much larger timeouts in section 4.5.3.2.  As pointed out by the RFC in relation to the DATA termination, "A spurious timeout at this point would be very wasteful and would typically result in delivery of multiple copies of the message."


                            A short timeout early on, with the TCP connect, is helpful for detecting an offline server. After that, longer times are needed. (FYI, even if the server isn't busy, a long initial prompt/banner delay of 20 or 30 seconds is a popular SPAM deterrent engineered into some mail servers. Personally, I bypass for my own trusted clients, but it is well within spec.)


                            • 11. Re: Send Mail (SMTP) doesn't wait long enough for server response
                              TSGal

                              Chris Irvine:

                               

                              Please post this suggestion to our Product Ideas board at:  Product Ideas

                               

                              The Product Ideas board is monitored by Product Management and Development.  All ideas are read, discussed and considered for possible implementation in a future release.

                               

                              TSGal

                              FileMaker, Inc.

                              • 12. Re: Send Mail (SMTP) doesn't wait long enough for server response
                                TorstenBernhard

                                TSGal

                                I have encountered this issue, too. And with all due respect, as this issue is known since AD 2012, I would have expected that this has since long made its way into your internal worklist of things to improve. Your post insinuates that this is considered as a non-issue and to the best, people can post an idea. I am making an educated guess: this will be so low on the list of priorities that it will not be handled within the next 5 years. Any better ideas?

                                • 13. Re: Send Mail (SMTP) doesn't wait long enough for server response
                                  TSGal

                                  TorstenBernhard:

                                   

                                  As explained above, the five second limit is the current design.  It is not scheduled to change, so that is why I suggested posting to the Product Ideas board, as it will then come to the attention of Product Management and Development who are responsible for product decisions.

                                   

                                  TSGal

                                  FileMaker, Inc.