mimeEncodeAsMIMEEmail

Typecommand
Dictionarylibrary.mime
LibraryMIME Library
Syntax
mimeEncodeAsMIMEEmail <pBody>,<pFrom>,<pTo>,<pCc>,<pSubject>,<pAttachmentA>
Associationscom.livecode.library.mime
Summary

Create data to be sent as an email

Parameters
NameTypeDescription
pBody

The pre-encoded body of the email. See the mimeEncodeFieldAsMIMEMultipartDocument function for an easy way to generate the body from field content.

pFrom

From email address

pTo

Recipient email addresses with one per line

pCc

Copy to email addresses with one per line

pSubject

Email subject line

pAttachmentA

A numerically indexed (1..N) multi-dimensional array. Each element describes a different attachment. The elements of the array may contain the following keys.

  • "filepath": The full path to the file. Optional if the "data" element has a value
  • "data": The file data. Optional if the "filepath" element has a value
  • "name": The file name. Optional if the "filepath" element has a value
  • "mimetype": The file mime type. Optional if the "filepath" or "name" element has an extension
Example
put mimeEncodeFieldAsMIMEMultipartDocument(the long id of field "email") into tBody
mimeEncodeAsMIMEEmail tBody, "sales@livecode.com", field "email", , "Purchase order"

local tBytes, tSettings, tResponseHeaders
put "username" into tSettings["username"]
put "p@$$w0rd" into tSettings["password"]

local tResult
put tsNetSmtpSync("smtps://mail.livecode.com:465", "sales@livecode.com", field "email", it, tResponseHeaders,tBytes,tSettings) into tResult
if tResult begins with "tsneterr:" then
   answer error "Error:" & word 2 to -1 of tResult
end if
Values
NameTypeDescription
It

Set to the email body including headers

The result

An error message if an error was encountered

Description

Creates the data to be sent as an email via an SMTP server