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

"Full Name <name@domain>"



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


replyTomust be an email address only and cannot include a name.


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


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 : the cc email list.

- bcc : the bcc email list.

- replyTo : a reply to email address only.

- html : the content of the HTML version of the email.

- attachments : a list of file paths for attachments to be included.


Version History:


- 3.1 :

- 4.0 : Added an RFC 1123 format date header.

- 4.0.2 : Renamed from BE_SMTPSend


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.


About SMTP Send and "Sent" Folders


A message being put into sent folder is a function of the mail client : it creates the message to send, tells the server to send it via SMTP, and then tells the server to save a copy in the sent folder via IMAP.

The BE plugin SMTP only does the SMTP send part. You'd need to have an IMAP plugin to save to the sent folder.

Other options are :

  • Some email services let you use an API instead of SMTP, ( eg google or O365 ) and that API may keep copies in the sent folder.
  • BCC to an archive email address that stores old copies on the mail server.
  • Keep them in a table in FileMaker instead.

Code 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" )

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

Still need help? Contact Us Contact Us