PlainText email doesn't line break as expected
Assuming you are using apex outboundEmail, I tried to replicate this using your string construction and my Util.sendEmail method (included):
String plainTextBody = '';
plainTextBody += 'Confirmed Late Delivery is changed to unticked \n';
plainTextBody += 'Delivered Status is changed to a value that is not Delivered Late \n';
plainTextBody += 'Late Code is changed \n';
plainTextBody += 'or Late Code Subcategory is changed \n\n';
Util.sendEmail(new List<String> {'[email protected]'}, new String[] {}, new String[] {}, 'sfse email line break' , plainTextBody);
// ---------------------------------------------------------------------
// sendEmail (to, cc, bcc)
// ---------------------------------------------------------------------
public static void sendEmail (String[] toRecipients, String[] ccRecipients,
String[] bccRecipients, String subject, String body) {
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
try {
Messaging.reserveSingleEmailCapacity(1);
email.setToAddresses(toRecipients);
email.setCcAddresses(ccRecipients);
email.setbccAddresses(bccRecipients);
email.setSubject(subject);
email.setPlainTextBody(body);
System.debug(LoggingLevel.INFO,'** entered sendEmail, to:' + toRecipients + ' cc:' + ccRecipients + ' bcc:' + bccRecipients + ' subject:' + subject + ' body:' + body);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
return;
}
catch (LimitException e) {throw new MyException('[UTIL-05] sendEmail error. No capacity to send email: ' + subject + '\n' + e.getMessage());}
catch (Exception e) {throw new MyException('[UTIL-04] sendEmail error. ' + e.getMessage());}
}
and in three different email clients - GMail, Yahoo Mail, Outlook 2013, I always get the body of the email, once I open the email (not the preview pane) to show four lines as in:
Me
To Me
Today at 3:12 PM
Confirmed Late Delivery is changed to unticked
Delivered Status is changed to a value that is not Delivered Late
Late Code is changed
or Late Code Subcategory is changed