Sending Form-Based Email; Sending Query-Based Email - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

208
Use 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.
Send a MIME file attachment along with a mail message.

Sending form-based email

In the example below, 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 FROM="#Form.EMailAddress#"
TO="marketing@allaire.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 email

In the example below, 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 QUERY="ProductRequests"
FROM="webmaster@allaire.com"
TO="marketing@allaire.com"
SUBJECT="ColdFusion status report">
Here is a list of people who have inquired about
Allaire ColdFusion over the last seven days:
<CFOUTPUT>
#ProductRequests.FirstName# #ProductRequests.LastName#
(#ProductRequests.Company#) - #ProductRequests.EMailAddress#
</CFOUTPUT>
Regards,
The WebMaster
webmaster@allaire.com
</CFMAIL>
Note the use of the nested CFOUTPUT tag to present a dynamic list embedded within
a normal CFMAIL message. The text within the CFOUTPUT is repeated for each row in
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

This manual is also suitable for:

Coldfusion 4.5

Table of Contents