New in ColdFusion MX: the SpoolEnable attribute is new.
Attributes
Attribute
Req/Opt
Default
Description
to
Required
�
Message recipient name(s).
Static address. For example, "support@macromedia.com"
Variable that contains an address. For example, "#Form.Email#".
Name of a query column that contains an address. For example, "#EMail#". An e-mail message is sent for each returned row.
from
Required
�
E-mail message sender:
A static string; for example, "support@mex.com"
A variable; for example, "#GetUser.EMailAddress#"
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.
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
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
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
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
�
-1
TCP/IP port on which SMTP server listens for requests. This is normally 25.
mailerID
Optional
ColdFusion Application Server
Mailer ID to be passed in X-Mailer SMTP header, which identifies the mailer application.
timeout
Optional
-1
Number of seconds to wait before timing out connection to SMTP server.
spoolEnable
Optional
Yes
Yes: Saves a copy of the message until the sending operation is complete. May be slower than the No option.
No: Queues the message for sending, without storing a copy until the operation is complete.
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> --->
Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.
Comments
Mark Champagne
said on
Mar 8, 2004
at
3:56 PM :
What does it mean when timeout is set to -1 ?? Infinity? Our ISP tells us that sometimes if we use CFMAIL to send out a single email it may timeout if someone else is sending out a very large mailing. I had it set to 60 seconds.
cgsj_usa@yahoo.com
said on
Apr 19, 2004
at
8:38 AM :
Does cfmail work in the scheduler in MX 6.1?! Thanks!
halL
said on
Apr 19, 2004
at
9:03 AM :
You should be able to use a cfmail tag on a page that you run as a scheduled task.
cgsj_usa@yahoo.com
said on
Apr 19, 2004
at
1:58 PM :
Hey, Hal. I found the problem. The CF scheduler won't pick up the task if the file is housed in a folder/directory where anonymous access (web server setting) is turned off. The scheduler runs as an anonymous service, so the file should be in a folder where it can be accessed. Thanks for your help with this.
Chris
chizzy123
said on
May 7, 2004
at
12:20 AM :
HOW do i detect whether an email bounces.
ASandstrom
said on
May 7, 2004
at
6:10 AM :
Have you taken a look at the following page in Developing Applications? I think this may be what you're looking for. http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/email7.htm
johndieter
said on
Mar 21, 2005
at
3:42 PM :
Did any version of cold fusion ever have a user and password attribute of the cfmail tag? I get the following error from some cf code i bought:
Attribute validation error for tag CFMAIL. The tag does not allow the attribute(s) PASSWORD,USERNAME. The valid attribute(s) are
Comments
Mark Champagne said on Mar 8, 2004 at 3:56 PM : cgsj_usa@yahoo.com said on Apr 19, 2004 at 8:38 AM :