Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I format a String in an email so Outlook will print the line breaks?

I'm trying to send an email in Java but when I read the body of the email in Outlook, it's gotten rid of all my linebreaks. I'm putting \n at the ends of the lines but is there something special I need to do other than that? The receivers are always going to be using Outlook.

I found a page on microsoft.com that says there's a 'Remove line breaks' "feature" in Outlook so does this mean there's no solution to get around that other than un-checking that setting?

Thanks

like image 827
MattGrommes Avatar asked Sep 25 '08 20:09

MattGrommes


People also ask

How do you do a line break in Outlook?

Inside the text box, right-click, and then select Paragraph. Select the Line and Page Breaks tab.

Why does Outlook remove line breaks?

Microsoft Outlook removes line breaks in signatures for messages sent in plain text format. For the sender, the message looks normal but when displayed to the recipient, line breaks are removed so the formatting of the signature is compromised.

How do you add a separator line in Outlook 365?

Using the Insert tab Click within the email message where you want the horizontal line to go. On the Insert tab in the Symbols group, click the Horizontal Line button. The line will appear in the message separating the paragraph into sections and is inserted for the full width of the page.

How do you insert a line break in plain text email?

You can insert a break into plaintext emails using {! BR()} .


2 Answers

I've just been fighting with this today. Let's call the behavior of removing the extra line breaks "continuation." A little experimenting finds the following behavior:

  • Every message starts with continuation off.
  • Lines less than 40 characters long do not trigger continuation, but if continuation is on, they will have their line breaks removed.
  • Lines 40 characters or longer turn continuation on. It remains on until an event occurs to turn it off.
  • Lines that end with a period, question mark, exclamation point or colon turn continuation off. (Outlook assumes it's the end of a sentence?)
  • Lines that turn continuation off will start with a line break, but will turn continuation back on if they are longer than 40 characters.
  • Lines that start or end with a tab turn continuation off.
  • Lines that start with 2 or more spaces turn continuation off.
  • Lines that end with 3 or more spaces turn continuation off.

Please note that I tried all of this with Outlook 2007. YMMV.
So if possible, end all bullet items with a sentence-terminating punctuation mark, a tab, or even three spaces.

like image 176
mtruesdell Avatar answered Oct 07 '22 21:10

mtruesdell


You need to use \r\n as a solution.

like image 38
Robert Wilkinson Avatar answered Oct 07 '22 21:10

Robert Wilkinson