You need to sign in to do that
Don't have an account?
Nazeer
Inbound email attachments
Hi,
How do we handle the attachments in inbound mail? I need to
capture email attachment as attachment in Salesforce. I had created Salesforce (case) records from
the contents of email but struggling to handle attachment. Any detail update on
this is highly appreciated.
How we can handle this through Apex EMAIL SERVICES
Thanks
Nazeer
Message Edited by Nazeer on 11-23-2007 07:35 AM
Here is an example of how you can loop through an inbound email and find all the attachments. In this case I create an attachment and link it to an emailMessage object I have created previously in the Apex code.
.....
if (email.binaryAttachments!=null && email.binaryAttachments.size() > 0) {
for (integer i = 0 ; i < email.binaryAttachments.size() ; i++) {
System.debug('Binary Attachments - filename: ' + email.binaryAttachments[i].filename);
System.debug('Binary Attachments - size: ' + email.binaryAttachments[i].mimeTypeSubType);
Attachment a = new Attachment(ParentId = em[0].Id,
Name = email.binaryAttachments[i].filename,
Body = email.binaryAttachments[i].body);
insert a;
}
}
...........
Your post is really helpful, we are currently testing the email services and experiencing some problems with the attachments,
Let's me clarify what we are doing.
1. we have received a lot of emails in outlook . say 5 thousands emails.
2. we want to forward these emails to Salesforce email service, each time we are going to forward 10-50 emails to salesforce
3. these forwarded emails become binary attachments, so we need to process these attachemnts in Salesforce email service.
4. With our emails service, let's call it processAttachment, we want to parse each attachment, as each one originally is an email.
Yes, we can loop through all the attachements, .to figure out filename, size, mimeTypeSubType (message/rfc822) .etc.
however we don't know how to convert each attachment into an inboundEmail object, so we can create task for each attachment?
We would really appreciate it if someone can help us with this?
Thanks a lot in advance!
Best Regards,
David Deng
Hi David,
Can you please post the code for this?
Thanks,
Did you ever figure out a solution to this? I'll keep digging but trying to solve this issue currently.
Thanks,
Daniel