Adobe COLDFUSION 9 Manual page 1211

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
Retrieve all parts of a message, including attachments
Create a ColdFusion page with the following content:
1
<html>
<head>
<title>POP Mail Message Attachment Example</title>
</head>
<body>
<h2>This example retrieves message header,
body, and all attachments:</h2>
<cfpop server="mail.company.com"
username=#myusername#
password=#mypassword#
action="GetAll"
attachmentpath="c:\temp\attachments"
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>
Attachments: #HTMLEditFormat(Sample.Attachments)# <br>
Attachment Files: #HTMLEditFormat(Sample.AttachmentFiles)# <br>
<br>
Body:<br>
#Sample.body# <br>
<br>
Header:<br>
HTMLCodeFormat(Sample.header)# <br>
<hr>
</cfoutput>
</body>
</html>
Edit the following lines so that they use valid values for your POP mail server, user name, and password:
2
<cfpop server="mail.company.com"
username=#myusername#
password=#mypassword#
Save the file as header_body_att.cfm in the myapps directory under your web_root and view it in your web browser:
3
Note: To avoid duplicate filenames when saving attachments, set the
Deleting messages
Using the cfpop tag to delete a message permanently removes it from the server. By default, retrieved messages remain
on the POP mail server. To delete the messages, set the
attribute to specify the messages to delete; omit the attribute to delete all the user's messages from the
messagenumber
server.
generateUniqueFilenames
attribute of the
action
Last updated 8/5/2010
attribute of
cfpop
tag to Delete. Use the
cfpop
1206
to
.
Yes

Advertisement

Table of Contents
loading

Table of Contents