Adobe COLDFUSION 9 Manual page 1210

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
<html>
<head><title>POP Mail Message Body Example</title></head>
<body>
<h2>This example adds retrieval of the message body:</h2>
<cfpop server="mail.company.com"
username=#myusername#
password=#mypassword#
action="GetAll"
name="Sample">
<cfoutput query="Sample">
MessageNumber: #HTMLEditFormat(Sample.messageNumber)# <br>
To: #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>
Body:<br>
#Sample.body#<br>
<br>
Header:<br>
#HTMLCodeFormat(Sample.header)#<br>
<hr>
</cfoutput>
</body>
</html>
2
Edit the following lines so that they use valid values for your POP mail server, user name, and password:
<cfpop server="mail.company.com"
username=#myusername#
password=#mypassword#
Save the file as header_body.cfm in the myapps directory under your web_root and view it in your web browser:
3
This example does not use a CFML function to encode the body contents. As a result, the browser displays the
formatted message as you would normally see it in a mail program that supports HTML messages.
Retrieving messages and attachments
When you use the cfpop tag with an
ColdFusion retrieves any attachment files from the POP server and saves them in the specified directory. The
tag fills the attachmentfiles field with a tab-separated list of the locations of the attachment files. Use the
delete these temporary files when they are no longer needed. ColdFusion creates the directory if it does not exist.
(ColdFusion must have the appropriate rights on the system to create the directory.)
If a message has no attachments, the
Note: CFML does not provide a way to change the name of a mail attachment returned by
the file. If the attachment name is invalid for the file system on which ColdFusion is running, the attachment cannot be
saved.
attribute to specify the directory in which to store attachments,
attachmentpath
and
attachments
attachmentfiles
Last updated 8/5/2010
cffile
columns contain empty strings.
before it tries to save
cfpop
1205
cfpop
tag to

Advertisement

Table of Contents
loading

Table of Contents