+ Start a Discussion
Maria Alexandra Andrica 6Maria Alexandra Andrica 6 

HTML email empty

Hello All

I'm sending an HTML email via Apex. But when opening the email in Outllok is empty. Eventhough in the preview I see there is text.
Can you please help?
 
Subramani_SFDCSubramani_SFDC
are you setting the subject in apex class?
Maria Alexandra Andrica 6Maria Alexandra Andrica 6
Yes, mail.setSubject(subject);
Subramani_SFDCSubramani_SFDC
Comment that line in your class and try
Maria Alexandra Andrica 6Maria Alexandra Andrica 6
Is not working. 
The code:
          htmlBody.escapeHtml4();
                toAddress.add(cont.email);
                mail.setToAddresses(toAddress);
                mail.setTargetObjectId(cont.OwnerId);
                mail.setTemplateId(et.id);
                mail.setPlainTextBody(plainBody);
                mail.setHtmlBody(htmlBody);
                mail.setTargetObjectId(cont.Id);
             //   mail.setSubject(subject);
                mail.setSaveAsActivity(true);
                mail.setOrgWideEmailAddressId(owea.get(0).Id);
                messages.add(mail);User-added image
Subramani_SFDCSubramani_SFDC
oh.try this .can you change the email template to custom email template if you are using html with letterhead email template?
Maria Alexandra Andrica 6Maria Alexandra Andrica 6
How can I allign the text in custom email template? I have all the text in one row without any new line. How can I add hyperlinks in custom email template?