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.

Categories

Email

Comments

comments powered by Disqus