304
Sample Uses of cfmail
An application page with the
based on the tag's settings. Some of the tasks you can accomplish with
include the following:
Sending form-based e-mail
In the following example, the contents of a customer inquiry form submittal are
forwarded to the marketing department. Note that the same application page could
also insert the customer inquiry into the database.
< cfmail
A customer inquiry was posted to our Web site:
Name: #Form.FirstName# #Form.LastName#
Subject: #Form.Subject#
#Form.InquiryText#
</cfmail>
Sending query-based e-mail
In the following example, a query (ProductRequests) is run to retrieve a list of the
customers who have inquired about a product over the last seven days. This list is
then sent, with an appropriate header and footer, to the marketing department:
< cfmail
Here is a list of people who have inquired about
MyCompany Widgets over the last seven days:
<cfoutput>
Sending a mail message whose recipient and contents are determined by data
the user enters in an HTML form
Using a query to send a mail message to a database-driven list of recipients
Using a query to send a customized mail message, such as a billing statement to
alist of recipients that is dynamically populated from a database.
Sending a MIME file attachment along with a mail message
from="#Form.EMailAddress#"
to="marketing@MyCompany.com"
subject="Customer Inquiry">
query="ProductRequests"
from="webmaster@MyCompany.com"
to="marketing@MyCompany.com"
subject="Widget status report">
Chapter 16 Sending and Receiving E-mail
tag dynamically generates e-mail messages
cfmail
cfmail