In the snippet below templateID can be queried and set active. However the template does not show in the resulting email. If instead, I use mail.setHtmlBody() it works fine. Any ideas why setTemplateID isn't working?


id templateID='00X1R000000f3T1UAI';
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
  • 1
    Did you call the method setTargetObjectId(targetObjectId)? – Hengky Ilawan Jun 11 at 1:48
  • Yeah, did that. Still no luck. Actually, created a temp ugly hack to get around it for now. – sberley 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.