CFMAIL

Lets you generate email messages.

CFMAIL
Attribute

Description

TO

Required. The name of the recipient(s) of the email message. This can be either a static address (e.g., TO="support@allaire.com"), a variable that contains an address (e.g., TO="#Form.Email#"), or the name of a query column that contains address information (e.g., 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 either be static (e.g., FROM="support@allaire.com") or dynamic (e.g., FROM="#GetUser.EMailAddress#").

CC

Optional. Indicates additional addresses to copy the e-mail 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 updated 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 e-mail 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 (e.g., the Netscape 2.0 e-mail 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 if you want to send more than one mail message, or if you want to send the results of a query within a single message.

MAXROWS

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

GROUP

Optional. Specifies the query column to use when you group sets of records together to send as a single mail message. For example, if you send a set of billing statements out to your customers, you might group on "Customer_ID."

STARTROW

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

Advanced CFMAIL Attributes

Use these attributes to specify a mail server and set other options.

CFMAIL
Attribute

Description

SERVER

The address of the SMTP server to use for sending messages.

PORT

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

TIMEOUT

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

Example

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