Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

'Failure' Error When Getting Attachments with CFExchangeMail

Engaged ,
Apr 24, 2020 Apr 24, 2020

Anyone had any luck get email attachments using the CFEXCHANGEMAIL tags?

We are able to establish a connection to Office365 and can get the mail.  But, when a message indicates it has an attachment and we try to get it, the whole operation crashes with only the word: 'Failure'  displayed on the page.

 

In this particular case there are 3 messages.  Just one has an attachment.

 

We are using CF2018.

 

 

<!--- This works fine --->
<cfexchangeconnection action="open"
     username="ouremail@ourdomain.com"
     password="XXXXXXX"
     server="outlook.office365.com"
     protocol="https"
     serverversion="2016"
     connection="tech_cxn"
     formBasedAuthentication="true"
     formBasedAuthenticationURL="https://outlook.office365.com/owa/auth/owaauth.dll">

<!--- This works fine, too --->
<cfexchangemail
    action = "get"
    name = "FindMail"
    connection = "tech_cxn">

    <cfexchangefilter name="Folder" value="Inbox"> 
    <cfexchangefilter name="MessageType" value="Mail"> 
    <cfexchangefilter name="maxRows" value="10"> 
</cfexchangemail>
<cfdump var="#FindMail#">

<!--- 
If we include this code, all we get is: Failure
It even 'bypasses' the display of the CFDump, above.
Nothing in the CF logs, either. 
--->
<cfloop query="FindMail">
	<cfif FindMail.HasAttachment IS "Yes">
		<cfexchangemail
            action = "getAttachments"
            name = "myMailAttachments"
            uid = "#FindMail.uid#"
            connection = "tech_cxn"
            folder="Inbox"
            attachmentpath="C:\temp"
            generateUniqueFilenames="true">

            <cfdump var="#myMailAttachments#">
	</cfif>
</cfloop>

 

 Following documentation here:

https://helpx.adobe.com/coldfusion/developing-applications/using-external-resources/interacting-with...

TOPICS
Advanced techniques
724
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Apr 24, 2020 Apr 24, 2020

Answered my own question.  It appears my install of CF did not have permission to write the C:\temp.  This also failed when I tried to save the attachments to S3.  However, when I changed the attachmentpath to: GetTempDirectory() it worked just fine.

 

An error a little more descriptive than "Failure" might have saved me the headache.

 

 

<cfexchangemail
            action = "getAttachments"
            name = "myMailAttachments"
            uid = "#FindMail.uid#"
            connection = "tech_cxn"
...
Translate
Engaged ,
Apr 24, 2020 Apr 24, 2020
LATEST

Answered my own question.  It appears my install of CF did not have permission to write the C:\temp.  This also failed when I tried to save the attachments to S3.  However, when I changed the attachmentpath to: GetTempDirectory() it worked just fine.

 

An error a little more descriptive than "Failure" might have saved me the headache.

 

 

<cfexchangemail
            action = "getAttachments"
            name = "myMailAttachments"
            uid = "#FindMail.uid#"
            connection = "tech_cxn"
            folder="Inbox"
            attachmentpath="#GetTempDirectory()#"
            generateUniqueFilenames="true">

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources