Chapter 13: Sending and Receiving Email
the message body:</H2>
<CFPOP SERVER="mail.company.com"
<CFOUTPUT QUERY="Sample">
</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"
4.
Save the file as
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>
USERNAME=#username#
PASSWORD=#password#
ACTION="GetAll"
NAME="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>
USERNAME=#username#
PASSWORD=#password#
hdrbody.cfm
in
under the Web root directory.
myapps
215
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?