function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RSKRSK 

how to generate a report of attachments within emails

Hi,

Hope any one can help me with this.

I wish to generate a report of attachments within emails( from Case Emails).  Is there a way to do this and if so how is it done.

 

Thanks a ton in advance!

 

 

Regards,

Kumar

Ispita_NavatarIspita_Navatar

Hi Kumar,

                  If you bind the attachments with email through apex code then you can use EmailFileAttachment object. The EmailFileAttachment object is used in the SingleEmailMessage object to specify attachments passed in as part of the request.

Below is the sample code to help you in resolving the issue faced by you:-

                                  

      Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();

      String[] toAddresses = new String[]{'info@salesforce.com'};

           email.setSubject( subject );

           email.setToAddresses(toAddresses);

           email.setPlainTextBody(Msg);

           email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});

           Messaging.SendEmailResult [] r =Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

 

RSKRSK

Thank you very much Ispita Saha.

 

 

-Kumar