(Updated January 11, 2011 10:20 am)
Send Mail via SMTP is a feature added in v10 of FileMaker Pro. The Send via SMTP option is also available to the Send Mail script step for FileMaker Pro, and is enabled for FileMaker Server. As a result we now have the ability to send email in the background (or in unattended mode via a server-side script), whereas prior versions required a FileMaker Pro client or third-party plug-in to send email.
As usual, with power comes responsibility. In this case, it means knowing your SMTP configuration details and correctly formatting email elements. Failure here is easy, often resulting in the general (and least informative) error, 1506: “Email(s) could not be sent successfully”. (See below for a common but unexpected condition that triggers this error.)
We’ve created a file that should help streamline the process of finding SMTP settings that work…(SMTP_SendMail_Interrogation.fp7; download now).
Update January 11, 2011 10:20 am: (added a config UI — script editing no longer required, as of v5!)
You provide the SMTP settings you want to examine for a particular SMTP mail server. When run, it will attempt to send email using every permutation of the settings, and tell you which combinations were successful. The test may take 60 seconds or longer to process all iterations.
Note: A puzzling cause of the 1506 error is related to the format of the email address given to the To: parameter, when you try to include the recipient’s name along with the address.
Specifically, it cannot be in the form that includes the full recipient name by using angle brackets around the email address: Full Name <account@domain.com> =BAD. While the Send via E-mail Client option lets you include the recipient’s name with the email address, only the address should be used with the Send via SMTP option. The angle brackets will be rejected by most SMTP servers.
Recommended best practice: use the alternative form that places parentheses around the name, as so: account@domain.com (Full Name) =GOOD. This will send both name and address when using the Send via E-mail Client option, and won’t trigger an error when using Send via SMTP.
Update November 10, 2009 10:30 am:
Let me add some clarity around FileMaker Pro’s Send Mail functionality, and the SMTP process in general. While the above fix will work as described, it doesn’t explain why. And it isn’t the whole story, because the FullName portion of an email such as “account@domain.com (FullName)” is not used by the Send via SMTP option. So below I expand my description of the cause and note one potentially limiting effect.
First, the ‘Send via SMTP’ option of the Send Mail command (and script step) expects only an email address (e.g. account@domain.com) as a value for the To: parameter. This is different than the To: field in an email client application (such as MS Outlook or Apple Mail), where a name can be entered along with the email address, usually in either of the two formats described above (with brackets or parentheses). The distinction is meaningful to this discussion because the two methods interact differently with SMTP mail servers.
When using the Send via SMTP option, any data in the To: other than the actual email address is superfluous to the SMTP server and usually is stripped out. Except for the angle brackets, which were required to delimit an email address in the original SMTP specification. This is why most mail client apps and middleware (PHP, Perl, etc.) functions will automatically add the brackets behind the scenes, if interpreted as missing. So another pair of brackets may be getting wrapped around your To: value, giving SMTP mail servers cause to reject the address and return an error.
Herein lies the caveat: we lose the ability to include a recipient’s name when we use FileMaker Pro’s Send via SMTP option. Now this really isn’t a major loss… people usually don’t display the To: column of their inbox. And since we’re not using an email client to send the message, we have no outbox in which to display a To: column.
One positive that I didn’t mention before: It may not be obvious that the To: parameter may contain multiple email addresses, separated by semi-colon or carriage returns.
Lastly, if the underlying mechanics are of interest, notice that the To: value in Send Mail’s dialog is evidently sent directly via a RCPT TO: command when Send via SMTP is the selected option. This RCPT TO: value is usually hidden in the message header, appearing as Envelope-To: — which must contain only a validly formatted email address. There also are RFC-compliance considerations at play, which constrain what can be done to the email header. Stray from the RFC specifications and your message will be considered malformed and rejected, or will be flagged as spam by most mail servers.
Hopefully, this single fix may resolve your troubles. Good luck!
File for download: SMTP_SendMail_Interrogation.fp7.zip
Great info Lee! Your “interrogation” file helped me fix an issue I was having with finding the correct settings. Big time saver!
Very slick! We’ve added a link to your post to our fmSpark documentation as folks sometimes have trouble getting their server settings dialed in. THANK YOU.
Thanks for this, one more for the knowledgebase. Just thought I’d pass on another thing: 1506 seems to be a “catch all”, we recently found a customer getting 1506 error when it turned out that their exchange server wasn’t allowing relaying. Wish Filemaker’s error reporting included a transcript of the conversation with the SMTP Server….
Thanks for clarifying this.
Hopefully with a future upgrade they will allow angle brackets. For now I think it’s best to play it safe and stick to email address only with no name.
SMTP_SendMail_Interrogation; gmail keeps getting shortened to com. 🙂 oops!
Hi Karen,
Sorry about the oversight; an overzealous autoentry ‘helper’ was filtering out the string “mail.” from the domain field. Thus reducing “gmail.com” to “gcom”. Not very useful, and has been fixed in v5.2.
Enjoy!
I was using your tool to test send via smtp server configuration. I got all the TLS configuration successful. But when I test it in my script, it still give me the 1506 error if the TO: parameter is outside of our company. Among these configurations, TLS with non authentication can send email internally in our company but not outside. I don’t understand why your file results said it’s successful, but I can not get it work.