BE_SMTP_Send

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

 

Sends an email via SMTP.  Use in conjunction with BE_SMTP_Server.  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
<name@domain>
FullName <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_Curl_Set_Option function, where applicable.

Version : 3.1

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 more 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_Curl_Set_Option ( "BE_CURLOPT_FORCE_STARTTLS" ; True )

before doing SMTP_Send.

Have more questions? Submit a request

12 Comments

  • 0
    Avatar
    Daniel E. Harlow

    What is the format to use for the from name and email address?

  • 0
    Avatar
    Jeremiah Hammond

    I have the same question: what format is "the from name and email address"?

  • 0
    Avatar
    Nicholas Orr

    Sorry for the slow reply, notifications were being lost.

    The format for an email address is either

    name@domain.com
    or
    Name Goes Here <emailaddresshere>

    So email address only can be by itself. A name and email starts with the name, and has the email address surrounded by angle brackets. Lists of emails are standard ¶ separated lists.

    Cheers,
    Nick

  • 0
    Avatar
    Michael Layne

    Hi Nick,
    Loving use of this new function. Thank you!! We use Mandrill for notifications and it works fine. An issue I'm having is that when sending HTML email, we're getting "printed-quotable" as the Content-Transfer-Encoding. It's causing the dreaded "3D" issue. Not sure, but it's the only readily visible difference from sending the exact same email with another plugin (which has the value of '7bit'). IF you need examples, I can provide. Does this make sense? I thought about setting CURL header, but not sure which one and if it would make a difference.

    Thanks!

    Content-Transfer-Encoding: quoted-printable

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://ww=
    w.w3.org/TR/html4/loose.dtd"><html lang=3D"en"><head> <meta http-equiv=
    =3D"Content-Type" content=3D"text/html; charset=3DUTF-8"> <meta name=3D"=
    viewport" content=3D"initial-scale=3D1.0"> <!-- So that mobile webkit wi=
    ll display zoomed in --> <meta name=3D"format-detection" content=3D"tele=
    phone=3Dno"> <!-- disable auto telephone linking in iOS --> <title>Notif=
    ication/Digest</title> <style type=3D"text/css"> body {-webkit-te=
    xt-size-adjust:none; -ms-text-size-adjust:none;} body {margin:0; pad=
    ding:0;} table {border-spacing:0;} th {font-weight: normal;} =
    /* table td {border-collapse:collapse;} / / Constrain email=
    width for small screens */ @media screen and (max-width: 760px) { =

  • 0
    Avatar
    Nicholas Orr

    Michael,

    Perhaps submit this as a bug report, and send details of the transcript and connection etc, so we can look into it. Is it that HTML doesn't render correctly? Is it all clients, or some clients, or only some servers?

    Cheers,
    Nick

  • 0
    Avatar
    Michael Layne

    Hi Nick,

    As in "Submit a request" here in Zendesk? Where, otherwise. Would be happy to.

  • 0
    Avatar
    Nicholas Orr

    Yep, that's it :)

    Cheers,
    Nick

  • 0
    Avatar
    david

    I have a case where I'd need to create a Draft (currently in Gmail, but that can change) rather than actually send the e-mail. The e-mail draft will be in HTML and should be able to hold multiple attachments.

    Users will then go in manually to their Gmail via a browser to edit the draft created by the FileMaker database, and send the e-mail when they're happy with it.

    Is this something that can be done right now, or if not, a feature that could be added?

  • 0
    Avatar
    Daniel E. Harlow

    David - you should use the GMail API to do this https://developers.google.com/gmail/api/ the Draft documentation is at https://developers.google.com/gmail/api/guides/drafts

  • 0
    Avatar
    david

    Thanks Daniel, I know that is an option, but as I mentioned, I'd prefer to have a way of doing this that doesn't only work for Gmail.

  • 0
    Avatar
    Nicholas Orr

    David,

    This is IMAP, not SMTP. Basically it's the same thing to save a message in a folder, is just doing a generic IMAP, there is no "draft" smtp.

    I've considered IMAP before as a future enhancement, but I think it would be a lot of work. Obviously and IMAP "read" function would be handy, and then a modify, to mark as read or create or delete, and then move as well.

    We've got a couple of things on the go, with regards to platform support which will be the highest priority, and then some PDF stuff, but this could come after that.

    Cheers,
    Nick

  • 0
    Avatar
    david

    Thanks Nick!

Article is closed for comments.