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
evaxxsevaxxs 

Send Attachment with email

I am curious if there is a way to send an attachmemt id from a Custom Object to the out of the box Email functionality with a Custom button. I currently use a global web service to send an email with an attachment but it all occurs behind the scene and the user can not interact with the web service. I don't want to create a VF Page to mimic the Email Functionality. 


Quote PDF allows me to do it by sending the docid. Is there a way to to the same thing on a Custom Object if I generate the PDF as an Attachment for the custom object?

farooq@consleaguefarooq@consleague

Hi,

 

If you want to add an attachment to your email, you will need to add only a few lines of code to your custom controller. Email attachments are Blob file types. To create an attachment, you need to use theApexMessaging.EmailFileAttachment class. You must define both the file name and the content of an EmailFileAttachmentobject.

 

Refer:

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_email_sending_attachments.htm

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_attachment.htm

 

Regards,

Md Farooq