Retrieving Attachments With Messages - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

Handling POP Mail
Note that 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 attachments with messages

When you use the
attribute to specify the directory in which to store attachements, ColdFusion gets
any attachment files from the POP server and puts them in the specified directory. It
also returns two additional columns:
You must make sure that the
cfpop
attachment file to a nonexistent directory.
Not all messages have attachments. If a message has no attachments,
and
To retrieve all parts of a message, including attachments:
1
2
cfpop
Contains a tab-separated list of all attachment names.
attachments
attachmentfiles
attachment files. Use the
tag to get attachments. ColdFusion generates an error if it tries to write an
are empty strings.
attachmentfiles
Create a new file in ColdFusion Studio.
Modify the file so that it appears as follows:
<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=#username#
password=#password#
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>
tag with
action="getAll"
Contains a tab-separated list of the locations of the
tag to delete these temporary files.
cffile
attachmentpath
, and use the
attachmentpath
directory exists before you use the
313
attachments

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents