Skip to content

Author: Avinash Vatsya

I wear many salesforce hats but prefer to be called as salesforce developer with 5+ years of experience having 19 active salesforce certifications.
I have trained/mentored a bunch of salesforce professionals and help them whenever needed.

How to send email from APEX with an attachment.

Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment(); efa.setFileName(‘test.pdf’); //File Name efa.setBody(someFile); efa.setContentType(‘application/pdf’); // File type email.setSubject( ‘adada’ ); email.setToAddresses( new String[] {‘[email protected]’}…

Leave a Comment