User Guide
312 Chapter 16 Sending and Receiving E-mail
Retrieving an entire message
When you use the cfpop tag with action="GetAll", ColdFusion returns the same
columns as with
getheaderonly, plus two additional columns, body and header.
To retrieve an entire message:
1 Create a new file in ColdFusion Studio.
2 Modify the file so that it appears as follows:
<html>
<head>
<title>POP Mail Message Body Example</title>
</head>
<body>
<h2>This example adds retrieval of the message body:</h2>
<cfpop server="mail.company.com"
username=#myusername#
password=#mypassword#
action="GetAll"
name="Sample">
<cfoutput query="Sample">
MessageNumber: #HTMLEditFormat(Sample.messageNumber)# <br>
To: #Sample.to# <br>
From: #HTMLEditFormat(Sample.from)# <br>
Subject: #HTMLEditFormat(Sample.subject)# <br>
Date: #HTMLEditFormat(Sample.date)#<br>
Cc: #HTMLEditFormat(Sample.cc)# <br>
ReplyTo: #HTMLEditFormat(Sample.replyTo)# <br>
<br>
Body:<br>
#Sample.body#<br>
<br>
Header:<br>
#HTMLCodeFormat(Sample.header)#<br>
<hr>
</cfoutput>
</body>
</html>
3 Change the following line so that it refers to a valid POP mail server, as well as to a
valid user name and password:
<cfpop server="mail.company.com"
username=#username#
password=#password#
4 Save the file as hdrbody.cfm in myapps under the Web root directory and view it
in the ColdFusion Studio Browse tab or your Web browser.