Syntax
#EMAIL(From,To,Subject[,Headers])Message#ENDEMAIL
Parameters
- From - Email address to appear in the email's FROM. It may be provided as a simple email address, or in the form: Contact Name <name@address.com>
- To - One or more comma-separated email addresses to send the email to. These email addresses will be visible in the email's TO. Similar to From, email addresses can be simple addresses or in the form: Contact Name <name@address.com>
- Subject - The email subject. If the subject contains UTF8 characters, the subject will be UTF8 encoded automatically.
- Headers - Optional new-line ("\n") separated headers, which will override or be appended to the defaults. Headers start with an identifier, followed by a colon and space (": "), followed by a value and new-line character ("\n") Common headers include:
- Cc - One or more comma-separated email addresses to be "carbon copied" on the email. These will be visible to recipients.
- Bcc - One or more comma-separated email addresses to be "blind carbon copied" on the email. These will not be visible to recipients.
- Content-Type - Common values are text/plain for plain text emails, and text/html for HTML emails.
- Message - The email message body is contain inside the #EMAIL block. It can contain plain text, UTF8 characters and/or HTML. The contents will be detected and encoded, and Content-Type header set accordingly. The detected Content-Type can be overridden with the Headers parameter, as described above.
Description
Send an email that may contain plain-text, UTF8 and/or HTML. The message body may also contain a MIME encoded email message, including HTML, images and other files and attachments. However, the MIME encoded message must be produced manually.
From, To and Subject parameters will be ignored if they are specified in the Headers parameter. Manually created headers override individual parameters.
This statement does not produce output, other than sending the email.
If email functionality is disabled on the server, a warning will be logged when #EMAIL is encountered to indicate that no email was sent.
Simple Example
#EMAIL('webmaster@webcomand.com', 'bob@email.com', 'Out of Office')
$FirstName $LastName will be out of the office this weekend.
#ENDEMAIL
Result
The out of office email message will be sent FROM webmaster@webcomand.com TO bob@email.com.
HTML Example
#NEW($Headers)
Bcc: spy@email.com
MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1
#ENDNEW
#EMAIL('Jim <jim@email.com>', 'bob@email.com', 'Out of Office', $Headers)
<style type="text/css">
p { margin: 24px 0; font-family: Arial, sans-serif; }
</style>
<p><strong>$FirstName $LastName</strong> is out of the office today.</p>
#ENDEMAIL
Result
The out of office email HTML message will be sent FROM jim@email.com TO bob@email.com.