
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 07:12 PM
I have a notification that is going out and it has a link that opens a reply email.
When I try and "preview" the notification it looks exactly like what I want, formatted nicely, but when I actually send the notification and click the link in Outlook, the reply comes up with all the correct values in the right places, but the body text is completely unformatted and shows as just a 'blob' of text.
This is being done via a mail script
EG:
In the notification in ServiceNow I select "Preview Notification", then click on the reply email link in the notification that is previewed, and the reply email is opened in Outlook:
This is the same reply that is also opened in Outlook, but the reply email link was from the same notification, but was actually sent and received in a mailbox:
It looks like it is interpreting the carriage returns in the preview and not at all using them in the other one.
My mail script code is:
var img = "/logo.png";
var response = "reply";
var emailbod = "This is some text that I want here\r\n";
emailbod += "\r\n";
emailbod += "(Then some more text goes here)\r\n";
emailbod += "And even more here\r\n";
emailbod += "Also here\r\n";
emailbod += "Then I want a new line here and -\r\n";
emailbod += "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
emailbod += "also here after some space.-\r\n";
template.print(renderlogolink(img, response, emailbod));
Ideas?
I've tried html such as <br> </br> and the like and it just adds that as text to the email body, doesn't get recognised as html tags at all
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 08:20 PM
@Moedeb give this a go:
var emailbod = encodeURIComponent("This is some text that I want here\r\n\r\n(Then some more text goes here)\r\nAnd even more here\r\nAlso here\r\nThen I want a new line here and -\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nalso here after some space.-\r\n");
You don't add them separately, they can all be done in the same string, but the encodeURIComponent(...) ensures special characters like line breaks (\n) are properly handled.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 08:20 PM
@Moedeb give this a go:
var emailbod = encodeURIComponent("This is some text that I want here\r\n\r\n(Then some more text goes here)\r\nAnd even more here\r\nAlso here\r\nThen I want a new line here and -\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nalso here after some space.-\r\n");
You don't add them separately, they can all be done in the same string, but the encodeURIComponent(...) ensures special characters like line breaks (\n) are properly handled.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 08:32 PM
@Bidduam that worked perfectly, thank you a heap 😁