2

I have an issue with processing inbound emails sent from MS Outlook. To put it simple no attachments are received in the class (nor text nor binary). Email definitely has attachments since i cc-ed the email to my gmail account.

If the email with attachment is sent from the gmail account everything works well.

Any thoughts or experiences?

the code:

global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env) 
    {
        System.debug(email);//no attachments all attachment binary and text are null
....}

I think this source could be more important:

Gmail source:

Content-Type: text/csv; charset=UTF-8; name="Karol_csv_short.csv"  
Content-Disposition: attachment; filename="Karol_csv_short.csv"  
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hytz9oxg0

Outlook source

Content-Type: application/vnd.ms-excel; name="Karol_csv_short.csv"
Content-Disposition: attachment; filename="Karol_csv_short.csv"
Content-Transfer-Encoding: base64
X-Attachment-Id: 1cad76b11d272e29_0.1

So the issue could be that the application/vnd.ms-excel content type is not understood by salesforce?

Thanks

  • same issue as the one described here: stackoverflow.com/questions/21630493/… merge suggestion? – zokito Aug 14 '14 at 10:18
  • No merge since the question is on stack overflow – zokito Aug 14 '14 at 10:23
  • If you have a custom inbound email service, I recommend you post the code for it. Otherwise, we're all simply making guesses. – crmprogdev Aug 14 '14 at 10:33
  • Hi it's not about the code but ok 'global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env) { System.debug(email);//no attachments all attachment binary and text are null ....}' – zokito Aug 14 '14 at 10:35
  • Please edit your post to include your code rather than asking us to read it in comments. Thank you. – crmprogdev Aug 14 '14 at 10:38
1

I just managed to do a workaround this issue...

I managed to found a way for inbound service to receive the attachments sent from MS Outlook. It seems that SFDC email service under the hood has a limited scope of Content-Type: headers it handles. If the .csv file is attached from Outlook it adds the header value not understood by salesforce Content-Type: application/vnd.ms-excel the attachment is then dropped by SFDC and it never reaches Messaging.InboundEmailHandler implementation.

First I'd like to stress out that this behavior presented by SFDC is invalid and that they should treat all unknown Content-Type: values as application/octet-stream and push them to InboundEmail.BinaryAttachment[] binaryAttachments property.

Then i tried to change the extension of the file to none, attach it in Outlook and see what will happen. Nothing did - again SFDC dropped the attachment which brings me to conclude that SF does not handle application/octet-stream at all.

Take three - I changed the extension of the file to plain old .txt and did the attach/send drill again and it worked. Content-Type: was set to text/plain; charset=UTF-8; by Outlook and SFDC understood it properly adding the file to the InboundEmail.TextAttachment[] textAttachments property.

So to highlight the resolution if somebody finds him/her self in this quite weird situation:

Just change the extension of the file to .txt if it is a .csv file you're trying to push to salesforce from Outlook

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.