CFMAIL | |
Description
Sends a e-mail message that contains query output, using an SMTP server. |
|
Category
Forms tags, Internet Protocol tags | |
Syntax<cfmail to = "recipient" from = "sender" cc = "copy_to" bcc = "blind_copy_to" subject = "msg_subject" type = "msg_type" maxrows = "max_msgs" mimeattach = "path" query = "query_name" group = "query_column" groupcasesensitive = "yes" or "no" startrow = "query_row" server = "servername" port = "port_id" mailerid = "headerid" timeout = "seconds" spoolenable = "yes" or "no"> | |
See also
cfftp, cfhttp, cfldap, cfmailparam, cfpop |
|
History
New in ColdFusion MX: the SpoolEnable attribute is new.
|
|
Example <h3>cfmail Example</h3> <p>This view-only example shows the use of cfmail. <!--- <cfif IsDefined("form.mailto")> <cfif form.mailto is not "" AND form.mailfrom is not "" AND form.Subject is not ""> <cfmail to = "#form.mailto#" from = "#form.mailFrom#" subject = "#form.subject#"> This message was sent by an automatic mailer built with cfmail: = = = = = = = = = = = = = = = = = = = = = = = = = = = #form.body# </cfmail> <h3>Thank you</h3> <p>Thank you, <cfoutput>#mailfrom#: your message, #subject#, has been sent to #mailto#</cfoutput>. </cfif> </cfif> <p> <form action = "cfmail.cfm"> <pre> TO: <input type = "Text" name = "MailTo"> FROM: <input type = "Text" name = "MailFrom"> SUBJECT: <input type = "Text" name = "Subject"> <hr> MESSAGE BODY: <textarea name ="body" cols="40" rows="5" wrap="virtual"></textarea> </pre> <!--- establish required fields ---> <input type = "hidden" name = "MailTo_required" value = "You must enter a recipient"> <input type = "hidden" name = "MailFrom_required" value = "You must enter a sender"> <input type = "hidden" name = "Subject_required" value = "You must enter a subject"> <input type = "hidden" name = "Body_required" value = "You must enter some text"> <p><input type = "Submit" name = ""> </form> ---> |
TO | |
Required | |
Message recipient name(s).
|
FROM | |
Required | |
E-mail message sender:
|
CC | |
Optional | |
Address(es) to which to copy the message. |
BCC | |
Optional | |
Address(es) to which to copy the message, without listing them in the message header. |
SUBJECT | |
Required | |
Message subject. Can be dynamically generated. For example, to send messages that give customers status updates, "Status of Order Number #Order_ID#". |
TYPE | |
Optional | |
Extended type attributes for message. Informs receiving e-mail client that message has embedded HTML tags to process. Used only by mail clients that support HTML.
|
MAXROWS | |
Optional | |
Maximum number of messages to send. |
MIMEATTACH | |
Optional | |
Path of file to attach to message. Attached file is MIME-encoded. |
QUERY | |
Optional | |
Name of cfquery from which to draw data for message(s). Use this attribute to send more than one message, or to send query results within a message. |
GROUP | |
Optional | |
Default value: "CurrentRow"
Query column to use when you group sets of records to send as a message. For example, to send a set of billing statements to a customer, group on "Customer_ID." Case-sensitive. Eliminates adjacent duplicates when data is sorted by the specified field. |
GROUPCASESENSITIVE | |
Optional | |
Default value: "Yes"
Boolean. Whether to consider case when grouping. If the query attribute specifies a query object that was generated by a case-insensitive SQL query, set this attribute to No, to keep the record set intact. |
STARTROW | |
Optional | |
Default value: "1"
Row in a query to start from. |
SERVER | |
Optional | |
SMTP server address to use for sending messages. Server must be specified here or in Administrator. A value here overrides the Administrator. |
PORT | |
Default value: "-1"
TCP/IP port on which SMTP server listens for requests. This is normally 25. |
MAILERID | |
Optional | |
Default value: "ColdFusion Application Server"
Mailer ID to be passed in X-Mailer SMTP header, which identifies the mailer application. |
TIMEOUT | |
Optional | |
Default value: "-1"
Number of seconds to wait before timing out connection to SMTP server. |
SPOOLENABLE | |
Optional | |
Default value: "Yes"
|