User Guide
Handling POP Mail 311
<h2>This example retrieves message header information:</h2>
<cfpop server="mail.company.com"
username=#myusername#
password=#mypassword#
action="GetHeaderOnly"
name="Sample">
<cfoutput query="Sample">
MessageNumber: #HTMLEditFormat(Sample.messageNumber)# <br>
To: #HTMLEditFormat(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>
</cfoutput>
</body>
</html>
3 Change the following line so that it refers to a valid POP mail server, as well as a
valid user name and password:
<cfpop server="mail.company.com"
username=#username#
password=#password#
4 Save the file as hdronly.cfm in myapps under the Web root directory and view it
in the ColdFusion Studio Browse tab or your Web browser.
This code retrieves the message headers and stores them in a cfpop query result set
called Sample.
The ColdFusion function HTMLEditFormat replaces characters that have meaning to
HTML, such as the < and > signs that can surround detailed e-mail address
information, with escaped characters such as < and >.
In addition, you can process the date returned by
cfpop with ParseDateTime, which
accepts an argument for converting POP date/time objects into a CFML date-time
object.
For information on these ColdFusion functions, see the CFML Reference.
You can reference any of these columns in a cfoutput tag, as the following example
shows.
<cfoutput>
#ParseDateTime(queryname.date, "POP")#
#HTMLCodeFormat(queryname.from)#
#HTMLCodeFormat(queryname.messageNumber)#
</cfoutput>