Hi everyone,
I’m encountering an issue where line breaks are being automatically removed by Outlook in emails that are ultimately sent via an external API, and I’m looking for advice on the best way to handle this within OutSystems.
Context:
I’m generating a multi-line string in OutSystems using an Assign widget.
This string is sent as part of a JSON payload to an external API.
That API is responsible for sending an email, which is received in Outlook.
The input string includes line breaks (\n, \r\n, or both), but in the final email viewed in Outlook, some or all line breaks are removed — the message appears collapsed or merged into fewer lines.
What I've Observed:
Outlook appears to automatically remove line breaks, likely interpreting them as "extra line breaks" in plain text.
In some cases, Outlook even displays a banner like:
“Extra line breaks in this message were removed. [Restore line breaks]”
Interestingly, when I use Outlook’s "Translate message" feature (e.g., Spanish to English), the line breaks are preserved correctly in the translated view.
What I’m Considering:
Since I don’t control the final email-sending mechanism, I don’t know whether the API sends the message as plain text or HTML.
One workaround I’m thinking of is to replace line breaks in OutSystems with tags before including them in the JSON, assuming the email content will support HTML.
But before doing that, I’d like to check if there’s a more elegant or standardized solution.
My Questions:
Is there a recommended approach in OutSystems to ensure line breaks survive through a JSON-to-email flow, especially when the final rendering happens in Outlook?
Would normalizing line breaks in the Assign (e.g., using just \n) help?
Is converting the content to HTML format with the most reliable solution?
Are there Outlook settings, headers, or flags the API should use to preserve line breaks by default?
Any guidance from those who’ve dealt with similar scenarios would be greatly appreciated.
Thanks in advance, Rahil Sayed
Hi Rahil,
Outlook, like any other mail app, uses HTML to display mail. As such, line breaks are treated as white space, and do not force an actual line break. Consider this HTML page:
<html> <body> <p>This is text in a paragraph and it is broken into various pieces by line breaks. </body> </html>
If you were to display that in a normal-sized window, all the text would appear on a single line.
So in short, if your mail API only allows text (and not HTML) as mail content, there is very likely no way to enforce a line break. You could try to send a <br> and see what happens, but it may also be that it is converted to <br> and you see a literal <br> in the text.