Tags · Functions · Objects
Lucee Tag Reference
Choose a tag:

Tag <CFMAIL>

Sends e-mail messages by an SMTP server.

Body

This tag must have a body.

Example

	<cfmail
		[async="boolean"]
		[bcc="object"]
		[cc="object"]
		[charset="string"]
		[failto="object"]
		from="object"
		[group="string"]
		[groupcasesensitive="boolean"]
		[mailerid="string"]
		[maxrows="number"]
		[mimeattach="string"]
		[password="string"]
		[port="number"]
		[priority="String"]
		[proxypassword="string"]
		[proxyport="number"]
		[proxyserver="string"]
		[proxyuser="string"]
		[query="string"]
		[remove="boolean"]
		[replyto="object"]
		[sendtime="datetime"]
		[server="string"]
		[startrow="number"]
		subject="string"
		[timeout="number"]
		[to="object"]
		[type="string"]
		[username="string"]
		[usessl="boolean"]
		[usetls="boolean"]
		[wraptext="number"]>

	</cfmail>
This tag is also supported within cfscript
	<cfscript>
		mail
		[async="boolean"]
		[bcc="object"]
		[cc="object"]
		[charset="string"]
		[failto="object"]
		from="object"
		[group="string"]
		[groupcasesensitive="boolean"]
		[mailerid="string"]
		[maxrows="number"]
		[mimeattach="string"]
		[password="string"]
		[port="number"]
		[priority="String"]
		[proxypassword="string"]
		[proxyport="number"]
		[proxyserver="string"]
		[proxyuser="string"]
		[query="string"]
		[remove="boolean"]
		[replyto="object"]
		[sendtime="datetime"]
		[server="string"]
		[startrow="number"]
		subject="string"
		[timeout="number"]
		[to="object"]
		[type="string"]
		[username="string"]
		[usessl="boolean"]
		[usetls="boolean"]
		[wraptext="number"] {

	}
	</cfscript>

Attributes

The attributes for this tag are fixed. Except for the following attributes no other attributes are allowed.
Name Type Required Description
async boolean No if set to true, the mail is sent asynchronously by the Lucee Task manager (with multiple tries),
if set to false the mail is sent in the same thread that executes the request, which is useful for troubleshooting because you get an error message if there is one.
This setting overrides the setting with the same name in the Lucee Administrator.
This attribute replaces the old "spoolenable" attribute which is still supported as an alias. 
bcc any No Indicates addresses to copy the e-mail message to, without listing them in the message header.
"bcc" stands for "blind carbon copy." 
cc any No Indicates addresses to copy the e-mail message to; "cc" stands for "carbon copy." 
charset string No Character encoding of the mail message 
failto any No Address to which mailing systems should send delivery failure notifications. Sets the mail envelope reverse-path value. 
from any Yes The sender of the e-mail message. 
group string No Specifies the query column to use when you group sets of records together to send as an e-mail
message. For example, if you send a set of billing statements to customers, you might group on
"Customer_ID." The group attribute, which is case sensitive, eliminates adjacent duplicates when the
data is sorted by the specified field. See the Usage section for exceptions. 
groupcasesensitive boolean No Boolean indicating whether to group with regard to case or not. The default value is NO;
case is considered while grouping. If the query attribute specifies a query object that was generated
by a case-insensitive SQL query, set the groupCaseSensitive attribute to NO to keep the recordset
intact. 
mailerid string No Specifies a mailer ID to be passed in the X-Mailer SMTP header, which identifies the mailer
application. 
maxrows number No Specifies the maximum number of e-mail messages to send. 
mimeattach string No Specifies the path of the file to be attached to the e-mail message. An attached file
is MIME-encoded. 
password string No A password to send to SMTP servers that require authentication. Requires a username attribute. 
port number No The TCP/IP port on which the SMTP server listens for requests. This is normally 25. 
priority String No The message priority level. Can be one of the following values:
* An integer in the range 1-5; 1 represents the highest priority.
* One of the following string values, which correspond to the numeric values: highest or urgent, high, normal, low, and lowest or non-urgent. 
proxypassword string No When required by a proxy server, a valid password. 
proxyport number No The port number on the proxy server from which the object is requested. Default is 80. When
used with resolveURL, the URLs of retrieved documents that specify a port number are automatically
resolved to preserve links in the retrieved document. 
proxyserver string No Host name or IP address of a proxy server. 
proxyuser string No When required by a proxy server, a valid username. 
query string No The name of the cfquery from which to draw data for message(s) to send. Specify this
attribute to send more than one mail message, or to send the results of a query within a message. 
remove boolean No remove all attachments from filesystem after the mail is successfully sent 
replyto any No Address(es) to which the recipient is directed to send replies. 
sendtime datetime No Set a future date time to send an email in the future via the spooler. 
server string No The address of the SMTP server to use for sending messages. If no server is specified, the
server name specified in the Lucee Administrator is used. 
startrow number No Specifies the row in the query to start from. 
subject string Yes The subject of the mail message. This field may be driven dynamically on
a message-by-message basis 
timeout number No The number of seconds to wait before timing out the connection to the SMTP server. 
to any No The name of the e-mail message recipient. 
type string No Specifies extended type attributes for the message. 
username string No A user name to send to SMTP servers that require authentication. Requires a password attribute. 
usessl boolean No Whether to use Secure Sockets Layer. 
usetls boolean No Whether to use Transport Level Security. 
wraptext number No Specifies the maximum line length, in characters of the mail text. If a line has more than the specified number of characters, replaces the last white space character, such as a tab or space, preceding the specified position with a line break. If there are no white space characters, inserts a line break at the specified position. A common value for this attribute is 72.