User Guide

Chapter 13: Sending and Receiving Email 215
the message body:</H2>
<CFPOP SERVER="mail.company.com"
USERNAME=#username#
PASSWORD=#password#
ACTION="GetAll"
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>
Body: #HTMLCodeFormat(Sample.BODY)# <BR>
Header: #HTMLCodeFormat(Sample.HEADER)# <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 hdrbody.cfm in myapps under the Web root directory.
Returning attachments with messages
When you use the CFPOP tag with ACTION="GetAll", and add the ATTACHMENTPATH
attribute, ColdFusion returns two additional columns:
ATTACHMENTS contains a a tab-separated list of all source attachment names.
ATTACHMENTFILES contains a tab-separated list of the actual temporary
filenames written to the server. Use the CFFILE tag to delete the temporary files.
Not all messages have attachments. If a message has no attachments, both
ATTACHMENTS and ATTACHMENTFILES will be equal to an empty string.
To retrieve all parts of a message including attachments:
1. Create a new file in Studio.
2. Modify the file so that it appears as follows:
<HTML>
<HEAD>
<TITLE>POP Mail Message Attachment Example</TITLE>
</HEAD>