I am trying to send an email from trigger using SingleEmailMessage.
As of now, I am composing my email body using the method
setHTMLBody inside the trigger itself and the email recipients are: user, contact and some hard-coded email address also.
My email has many recipients and I have some complex logic so I have to go for visualforce email template.
While I tried, I found the following points:
- I have to use
singleemailmessageonly as I have to use VisualForce email template
- More than one id cannot be added in the
setTargetObjectIdmethod so I cannot mail to more than one person.
- Also if I use an email template, I have to specify the recipient type as User/Lead/Contact but in my case I have to send email to user & contact & some email address. As of now, I am doing it using
My Question: Is it possible to replace the email body using VisualForce email template instead of composing it using