Sending E-mail Messages
303
Sending SMTP mail with cfmail
The
cfmail
tag provides support for sending SMTP e-mail from within ColdFusion
applications. The
cfmail
tag is similar to the
cfoutput
tag, except that
cfmail
outputs the generated text as SMTP mail messages rather than to a page. The
cfmail
tag supports all the attributes and commands that you use with
cfoutput
, including
query
.
To send a simple e-mail message:
1
Create a new file in ColdFusion Studio.
2
Modify the file so that it appears as follows:
<html>
<head>
<title>Sending a simple e-mail</title>
</head>
<body>
<h1>Sample e-mail</h1>
<cfmail
from="[email protected]"
to="#URL.email#"
subject="Sample e-mail"
>
This is a sample e-mail to show basic e-mail capability.
</cfmail>
The e-mail was sent.
</body>
</html>
3
Save the file as
sendmail.cfm
in
myapps
under the Web root directory.
4
Open your browser and enter the URL that contains the file; for example:
http://localhost/myapps/[email protected]
(Replace
with your e-mail address.)
The page sends the e-mail to you, through your SMTP server.
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...