+ Start a Discussion
Sindhu NagabhushanSindhu Nagabhushan 

Include Attachments in email sent via apex trigger

We are using Email-To-Case feature. 
I have a custom email field on case. When a new case is created, i want to send an automatic email to that email field along with the attachments in "Attachments related list".

How to do this using apex trigger?
Carlos Campillo GallegoCarlos Campillo Gallego
Hi Sindhu,

I'll suggest you to create a Record Type specifically for these cases and then create a Case Trigger checking that the just created Case is one of the Email-To-Case type. Once you have checked that you will have to use (if you want) this standard methods for sending emails from Salesforce and add an attachment. I think this link might help you:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_sendemail.htm


Kind regards,

Carlos.