I have a long text area field (Customer_Issues__c) which I'm trying to send using the Apex SendEmail method. The field displays properly in Salesforce with line breaks and paragraphs. When I try to send it as the body of an email, the paragraphs and line breaks aren't displaying properly. When I try to pull the data using workbench, I don't see any html formatting. What am I doing wrong?
string issues = a.Customer_Issues__c;
body = issues;
EmailManager em = new EmailManager();
em.sendMail(adresses, 'TEST Automated Alert: Updated Code Red Account- ' + a.Name, body);
Send Email
public void sendMail(String address, String subject, String body) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[]{};
for(String emailId:address.split(',')){
if(emailId != null && emailId !=''&& emailId != ' '){
toAddresses.add(emailId.trim());
}
}
mail.setToAddresses(toAddresses);
mail.setSubject(subject);
mail.setHtmlBody(body);
Messaging.SendEmailResult[] results = Messaging.sendEmail(
new Messaging.SingleEmailMessage[] { mail });
}
I don't think it matters but I'm calling the SendEmail from a trigger.