cfmail

<CFMAIL TO="recipient "
   FROM="sender"
   CC="copy_to"
   SUBJECT="msg_subject"
   TYPE="msg_type"
   QUERY="query_name "
   MAXROWS="max_msgs"
   MIMEATTACH="path"
   GROUP="query_column"
   STARTROW="query_row"
   SERVER="servername "
   PORT="port_ID"
   TIMEOUT="seconds">

CFMAIL allows you to generate email messages and post them to a specified server.

Attributes

TO

Required. The name of the recipient(s) of the email message. This can be either a static address (as in, TO="support@allaire.com"), a variable that contains an address (such as, TO="#Form.Email#"), or the name of a query column that contains address information (such as, TO="#EMail#"). In the latter case, an individual email message is sent for every row returned by the query.

FROM

Required. The sender of the email message. This attribute may be either static (e.g., FROM="support@allaire.com") or dynamic (as in, FROM="#GetUser.EMailAddress#").

CC

Optional. Indicates additional addresses to copy the email message to. This attribute may also be static or dynamic.

SUBJECT

Required. The subject of the mail message. This field may be driven dynamically on a message-by-message basis. For example, if you want to do a mailing that updates customers on the status of their orders, you might use a subject attribute like SUBJECT="Status for Order Number #Order_ID#".

TYPE

Optional. Specifies extended type attributes for the message. Currently, the only valid value for this attribute is "HTML". Specifying TYPE= "HTML" informs the receiving email client that the message has embedded HTML tags that need to be processed. This is only useful when sending messages to mail clients that understand HTML (such as the Netscape 2.0 email client).

QUERY

Optional. The name of the CFQUERY from which you want to draw data for message(s) you want to send. Specify this attribute to send more than one mail message, or to send the results of a query within a single message.

MAXROWS

Optional. Specifies the maximum number of email messages you want to send.

MIMEATTACH

Optional. Specifies the path of the file to be attached to the email message. Attached file is MIME-encoded.

GROUP

Optional. Specifies the query column to use when you group sets of records together to send as a single email message. For example, if you send a set of billing statements out to your customers, you might group on "Customer_ID." The GROUP parameter eliminates sequential duplicates in the case where the data is sorted by the specified field.

STARTROW

Optional. Specifies the row in the query to start from.

SERVER

Required. The address of the SMTP server to use for sending messages. The server name specified in the Cold Fusion Administrator is used if no server is specified.

PORT

The TCP/IP port on which the SMTP server listens for requests. This is almost always 25.

TIMEOUT

Optional. The number of seconds to wait before timing out the connection to the SMTP server.

Example

The following example CFMAIL tag uses form variables to resolve the From, To, Subject, and message body components of the mail message.

<!—- SEND THE MESSAGE TO THE MAILING LIST —->
 
<CFMAIL QUERY="GetList"
   TO="#Email#"
   FROM="CoffeeValley List Manager"
   SUBJECT="#Form.Subject#">
   #FORM.Body#
</CFMAIL>

BuiltByNOF