Skip to main content
1 of 3
Kevin P
  • 7.3k
  • 2
  • 28
  • 41

@Lemon, You want to follow the code example found here:

Using APEX to assemble HTML Letterhead Emails

Essentially, by wrapping the sendEmail call in a db transaction that you immediately rollback, you end up with a Merged template that you can inject into a send without using setTargetObjectId.

Kevin P
  • 7.3k
  • 2
  • 28
  • 41