216
<BODY>
<H2>This example retrieves message header,
body, and all attachments:</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
Note
Deleting messages
By default, retrieved messages are not deleted from the POP mail server. If you want to
delete retrieved messages, you must set the ACTION attribute to Delete.
Note
The MESSAGENUMBER attribute returned by all CFPOP retrievals contains the
message number you need to pass back to the POP mail server to have the
corresponding message deleted. A few notes:
Note
USERNAME=#username#
PASSWORD=#password#
ACTION="GetAll"
ATTACHMENTPATH="c:\attachdir"
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>
Attachments: #HTMLEditFormat(Sample.ATTACHMENTS)# <BR>
Attachment Files: #HTMLEditFormat(Sample.ATTACHMENTFILES)# <BR>
Body: #HTMLCodeFormat(Sample.BODY)# <BR>
Header: #HTMLCodeFormat(Sample.HEADER)# <BR>
USERNAME=#username#
PASSWORD=#password#
in
attach.cfm
To avoid duplicate file names when saving attachments, use the
GENERATEDUNIQUEFILENAMES attribute of CFPOP and set it to Yes.
Once a message is deleted, it's gone for good.
Message numbers are reassigned at the end of every POP mail server
communication that contains a delete action. For example, if four
messages are retrieved from a POP mail server, the message numbers
Developing Web Applications with ColdFusion
under the Web root directory.
myapps
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?
Questions and answers