Email listener Attachment Issue
|Knowledge Article Number||000193349|
While sending an email (with CSV attachment) using outlook the text attachment is null when trying to retrieve it via the email handler class. However when sending an email from Gmail (with CSV attachment) the text attachment is treated correctly in email handler class.
Reason for email failure through Outlook is because of different MIME type. In case of gmail: text/csv and in case of Outlook: application/octet-stream
1)Send an email using gmail to Email Service: CreativeDataHandler with an CSV attachment
2)Send an email using outlook to Email Service: CreativeDataHandler with an CSV attachment
The email service is setup to only accept text attachments. Application/octet-stream is a binary attachment. If you want to accept binary attachments, go to the setup page that defines the service and ensure that all attachment types are accepted. Note however that in Apex code these Outlook attachments will appear in the binary attachments list not in the text attachments list and we may need to convert the binary data to a String to work with it. If we want to have potentially simpler logic you can check the "treat text attachments as binary" then *all* attachments will end up in the binary attachments list.