Notice: With the launch of Adobe Cookbooks, this site will no longer be accepting new entries or posting new content. Thanks to everyone who submitted content!

How can I retrieve attachments from an email message?

Use <cfpop> with the action attribute set to 'getall' and the attachmentpath attribute set to the directory on your server that you want to save any attachments.

You can then loop over the resulting query object to perform any other required logic such as logging the attachment information

<!--- open mailbox --->
<cfpop
action="getall"
name="Q_emailGetAll"
server="SERVER_NAME"
username="USERNAME"
password="PASSWORD"
attachmentpath="\\SERVER_NAME\FOLDER\">


<!--- result set is a query object --->
<cfloop query="Q_emailGetAll">
<cfoutput>
#Q_emailGetAll.attachments#
#Q_emailGetAll.attachmentfiles#
</cfoutput>
</cfloop>

This entry was based on a suggestion by Stefan Leroux


This question was written by Jeremy Petersen.
It was last updated on July 17, 2008 at 10:05:25 AM EDT.

CFML Referenced

<cfpop>
<cfoutput>
<cfloop>

Categories

Email

Comments

There are no comments for this entry.