BE_SMTPSend

BE_SMTPSend ( from ; to ; subject ; text { ; cc ; bcc ; replyTo ; html ; attachments } )

Sends an email via SMTP.  Use in conjunction with BE_SMTPServer.  The To, CC, BCC and attachments can be passed value lists in order to send to multiple people or to include multiple attachments.  

Email addresses are in the format :

name@domain<br>"<name@domain>Full Name" <name@domain>	</name@domain>

If you're including an actual name, you MUST include angle brackets around the email address.

replyTo must be an email address only and cannot include a name.

This function can also use the options in the BE_CurlSetOption function, where applicable.

Version : 3.1
4.0 Added an RFC 1123 format date header.
4.0.2 : Renamed from BE_SMTPSend

Parameters :

from :  the from name and email address.
to : who the email is to be sent to.  A list for multiple recipients.
subject : required, but can be an empty string.
text : required, but can also be empty.
cc ( optional ) : the cc email list.
bcc ( optional ) : the bcc email list.
replyTo ( optional ) : a reply to email address only.
html ( optional ) : the content of the HTML version of the email.
attachments ( optional ) : a list of file paths for attachments to be included.

Results : ? for errors.  Check the BE_GetLastError for error codes, and the BE_CurlTrace for details.

Notes :

The content of emails on some servers appears to strip FileMaker line endings. Try replacing Char ( 13 ) with Char ( 10 ) in the email content.

Some servers, in particular various Exchange or Office365 based servers use a different authentication method.  When attempting SMTP normally you may get a 35 error.  You can force the correct method with :

BE_CurlSetOption ( "BE_CURLOPT_FORCE_STARTTLS" ; True )

before doing BE_SMTPSend.

Examples :

BE_SMTPSend ( "me@me.com" ; "you@you.com" ; "Subject goes here" ; $textContent  ; $cc ; $bcc ; "replyto@me.com" ; $htmlContent ; "/path/to/doc.pdf¶/path/to/secondDoc.pdf" )

See also https://docs.baseelementsplugin.com/article/444-besmtpaddattachment for other attachment examples using container fields.

Still need help? Contact Us Contact Us