You need to sign in to do that
Don't have an account?
Is there a way to e-mail attachments from Notes and Attachments?
Hi Experts,
Does anyone know of a way to attach files, to an e-mail, from notes and attachments? Instead of downloading the attachement to the hard drive and uploading to the e-mail.
Any help would be greatly appreciated, thank-you.
v/r
Shane Quiring
Does anyone know of a way to attach files, to an e-mail, from notes and attachments? Instead of downloading the attachement to the hard drive and uploading to the e-mail.
Any help would be greatly appreciated, thank-you.
v/r
Shane Quiring
Please mark this as best answer if it really helps you.
All Answers
//Put your record id in ParentId
List<Attachment> attList = [SELECT id, Name, body, ContentType FROM Attachment WHERE ParentId = : opp.id];
// List of attachments handler
Messaging.EmailFileAttachment[] efaList = new Messaging.EmailFileAttachment();
for(Attachment att : attList)
{ // Create the email attachment Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName(att.Name);
efa.setBody(att.body);
efa.setContentType(att.ContentType);
efa.setInline(false);
efaList.add(efa); }
// Attach files to email instance
email.setFileAttachments(efaList);
Please mark this as Best answer if it helps you and let me know if you finding any difficulty in this.
Thank-you for the information, this is great but I do have a couple of questions
Forgive my ingnorance here, I am extremly new to APEX and coding:
1. You had stated that I can "based on some button like take Send Email button". Will also include the "Attach File" button on the e-mail interface?
2. How do I base it off a button, like "Send an Email"?
Thank-you for your assistance.
And that particular scenarion can be achived by code which i shared.
Yes you are correct. Great!. Correct me if I am wrong; in the coding that you had provided, all I have to do is adjust this part of the coding:
//Put your record id in ParentId
List<Attachment> attList = [SELECT id, Name, body, ContentType FROM Attachment WHERE ParentId = : opp.id];
Where if I wanted to have run on the Account object I would use Account.id, etc. ... Correct?
Which would mean that if I wanted use this for any object, I would have to change the ParentId to the specfic object, in essence creating one trigger per object. Correct?
Thank-you for your assistance.
v/r
Shane
Please mark this as best answer if it really helps you.
Can you please check this application for Email Attachments,
MassMailer Docs is the best way to store and mass email your Salesforce files to contacts or leads
Attach files to Salesforce objects and mass email them as file attachments to your contacts or leads in one go.
For this, you might need to visit and play with this app -Massmailer Docs
For more details about massmailer docs please click here Link