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.
If email functionality is disabled on the server, a warning will be logged when #EMAIL is encountered to indicate that no email was sent.
Prototype
#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.
Text Example
#/ Send out of office email FROM webmaster@webcomand.com TO bob@email.com.
#EMAIL('webmaster@webcomand.com', 'bob@email.com', 'Out of Office')
$FirstName $LastName will be out of the office this weekend.
#ENDEMAIL
HTML Example
#/ Send HTML out of office email FROM jim@email.com TO bob@email.com.
#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