0

I am able to send an email from VF page, and am getting the emails with the proper text formatting, but I am not getting the letterhead associated to the email template that I am referencing. Is that even possible? Based on my research it seems like other folks have the same problem. My email template has letterhead that i would like to utilize, but it is not coming over with the email. Has anyone done anything similar?

EmailTemplate emailTemplate = [select Id, DeveloperName, HtmlValue, Body From EmailTemplate where DeveloperName = 'LTRO_Additional_Documents_Required'];
    //////////////////////////////////////////////////////        
           String htmlBody = emailTemplate.HTMLValue;
           htmlBody = htmlBody.replace('NewEmail', emailBody);
           mail.setHtmlBody(htmlBody);
    ///////////////////////////////////////
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
1

You can query the BrandTemplateId from the EmailTemplate object, and from there, you can query the BrandTemplate, which is in HTML form. You'll need to do some parsing via Dom.Document or some other means, but it is certainly possible to gain access to the letterhead.

| improve this answer | |
  • Thank you for the information. Would you happen to have an example of this? I did find something similar in my research, and did find out that I can query the brandTemplate, but not sure how I can incorporate that when I send the email out. This is where I get lost. – Ivo Dimov Oct 2 '18 at 19:09

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.