Add Line Break to body of email notification

Edwin Fuller
Tera Guru

I need to add line breaks to the body of an email notification. When I navigate to the "sys_email" table and view the email. It is adding the line breaks correctly. However, when receiving the email in my inbox, it is not. Anybody know why and how to correct it? I am using a script to create the notification, see script below.

Screen Shot from sys_email table

find_real_file.png

Screen Shot of email received in inbox

find_real_file.png

Script 

var sender = email.from;
var mail = new GlideRecord("sys_email");
mail.initialize();
mail.subject = 'Your Incident could Not be created';
mail.body = 'In an effort to protect your sensitive information, we were unable to process your email sent to the HMS Helpdesk. Please make sure any sensitive data like passwords and socials are not included in the email. You will also need to remove any references to passwords or socials such as (ssn, pw, password,…).' + '\n\n' + 'As always, you may also call the Helpdesk for immediate assistance at 855-554-6748.' + '\n\n' + 'Thank you,' + '\n\n' + 'HMS Helpdesk';
mail.user_id = sender;
mail.recipients = sender;
//mail.content_type = 'text/html';
mail.checkpoint = 0;
mail.mailbox = 'outbox';
mail.type = 'send-ready';
mail.weight = 50;
mail.insert();
}

 

1 ACCEPTED SOLUTION

rlatorre
Kilo Sage

Try replacing "\n\n" with "<br /><br />". The body of the email is read as HTML.

View solution in original post

3 REPLIES 3

rlatorre
Kilo Sage

Try replacing "\n\n" with "<br /><br />". The body of the email is read as HTML.

Thank you, that worked like a charm 🙂 

I have used the above for one of my requirement, it's working as expected. Thanks!