User Guide

306 Chapter 16 Sending and Receiving E-mail
Customizing E-mail for Multiple Recipients
In the following example, a query (GetCustomers) is run to retrieve the contact
information for a list of customers. This query is then used to send an e-mail to each
customer asking the person to verify that the contact information is still valid:
<cfmail query="GetCustomers"
from="service@MyCompany.com"
to="#EMail#"
subject="Contact Info Verification">
Dear #FirstName# -
Wed like to verify that our customer
database has the most up-to-date contact
information for your firm. Our current
information is as follows:
Company Name: #Company#
Contact: #FirstName# #LastName#
Address:
#Address1#
#Address2#
#City#, #State# #Zip#
Phone: #Phone#
Fax: #Fax#
Home Page: #HomePageURL#
Please let us know if any of the above
information has changed, or if we need to
get in touch with someone else in your
organization regarding this request.
Thanks,
Customer Service
service@MyCompany.com
</cfmail>
Note that in the to attribute of cfmail, the #Email# query column causes one
message to be sent to the address listed in each row of the query, and that the mail
body therefore does not use a cfoutput tag. Also note the use of the other query
columns (FirstName, LastName, and so on) within the
cfmail section to customize
the contents of the message for each recipient.