Reviewing the code
The following table describes the code and its function:
Code
<cfquery name="GetCustomers"
datasource="myDSN">
SELECT * FROM Customers
</cfquery>
<cfmail query="GetCustomers"
from="service@MyCompany.com"
to="#GetCustomers.EMail#"
subject="Contact Info
Verification">
Dear #GetCustomers.FirstName#
...
Company Name: #GetCustomers.Company#
Contact: #GetCustomers.FirstName#
#GetCustomers.LastName#
Address:
#GetCustomers.Address1#
#GetCustomers.Address2#
#GetCustomers.City#,
#GetCustomers.State#
#GetCustomers.Zip#
Phone: #GetCustomers.Phone#
Fax: #GetCustomers.Fax#
Home Page: #GetCustomers.HomePageURL#
Using cfmailparam
You use the
cfmailparam
nest the
cfmailparam
Attaching files to a message
You use one
cfmailparam
<cfmail from="daniel@MyCompany.com"
to="jacob@YourCompany.com"
subject="Requested Files">
Jake,
Here are the files you requested.
Regards,
Dan
<cfmailparam file="c:\widget_launch\photo_01.jpg">
<cfmailparam file="c:\widget_launch\press_release.doc">
</cfmail>
You must use a fully qualified system path for the
be located on a drive on the ColdFusion server machine (or a location on the local network), not
the browser machine.
Description
Retrieves all data from the Customers table into a query
named GetCustomers.
Uses the
#GetCustomers.Email#
message to be sent to the address listed in each row of
the query. Therefore, the mail body does not use a
cfoutput
Uses other query columns (
#GetCustomers.LastName#
section to customize the contents of the message for
each recipient.
tag to attach files or add a custom header to an e-mail message. You
tag within the
cfmail
tag for each attachment, as the following example shows:
attribute of
to
cfmail
query column causes one
tag.
tag.
attribute of
file
, the
#GetCustomers.FirstName#
, and so on) within the
. The file must
cfmailparam
Using cfmailparam
,
cfmail
795
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers