17
Views
1
Comments
Outlook Automatically Removing Line Breaks in Email Sent via JSON API (OutSystems)
Application Type
Reactive, Service
Service Studio Version
11.55.33 (Build 64295)
Platform Version
11.37.0 (Build 45622)

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:

  1. 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?

  2. Would normalizing line breaks in the Assign (e.g., using just \n) help?

  3. Is converting the content to HTML format with 
     the most reliable solution?

  4. 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



Screenshot 2025-08-07 172243.png
Screenshot 2025-08-07 172340.png
sample email data random.txt
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

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 &lt;br&gt; and you see a literal <br> in the text.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.