Sample Uses Of Cfmail; Sending Form-Based E-Mail; Sending Query-Based E-Mail - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

Sample uses of cfmail

An application page containing the
the tag's settings. Some of the tasks that you can accomplish with
Sending a mail message in which the data the user enters in an HTML form determine the
recipient and contents
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 a list of
recipients that is dynamically populated from a database
Sending a MIME file attachment with a mail message

Sending form-based e-mail

In the following example, the contents of a customer inquiry form submittal are forwarded to the
marketing department. You could also use the same application page to insert the customer
inquiry into the database. You include the following code on your form so that it executes when
users enter their information and submit the form:
<cfmail
from="#Form.EMailAddress#"
to="marketing@MyCompany.com,sales@MyCompany.com"
subject="Customer Inquiry">
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) retrieves a list of the customers who inquired
about a product during the previous seven days. The list is then sent, with an appropriate header
and footer, to the marketing department:
<cfmail
query="ProductRequests"
from="webmaster@MyCompany.com"
to="marketing@MyCompany.com"
subject="Widget status report">
Here is a list of people who have inquired about
MyCompany Widgets during the previous seven days:
<cfoutput>
#ProductRequests.FirstName# #ProductRequests.LastName#
(#ProductRequests.Company#) - #ProductRequests.EMailAddress#&##013;
</cfoutput>
Regards,
The WebMaster
webmaster@MyCompany.com
</cfmail>
792
Chapter 35: Sending and Receiving E-Mail
tag dynamically generates e-mail messages based on
cfmail
include the following:
cfmail

Advertisement

Table of Contents
loading
Need help?

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

This manual is also suitable for:

Coldfusion mx

Table of Contents