You need to sign in to do that
Don't have an account?
inbound email service apex class does not see all attachments
The oft copied code below (which is hopefully correct), successfully processes binary attachments apart from some emails forwarded (with attachments) from gmail. (An email snapshot confirms that the inbound email has attachments). Has anybody had a similar problem? Is there anything obviously wrong with the code below?
if (email.binaryAttachments != null && email.binaryAttachments.size() > 0) {
for (integer i = 0 ; i < email.binaryAttachments.size() ; i++) {
Attachment attachment = new Attachment();
// attach to the newly created email record
attachment.ParentId = e.Id;
attachment.Name = email.binaryAttachments[i].filename;
attachment.Body = email.binaryAttachments[i].body;
insert attachment;
}
}
Thanks,
Craig
with the 2 JPG attachments.
The email snapshot shows them. e.g.
Content-Type: 'image/JPEG'; name="1307262206280001.jpg"
Content-Disposition: attachment; filename="1307262206280001.jpg"
Content-Transfer-Encoding: base64
X-Attachment-Id: cc1846a3c009b87f_0.1
I accept all attachments and process text attachments as well (using almost
identical code).
If I compose a new email and send it with the same two attachments my apex
code sees the attachments???