Outlook autocleaning my line breaks and screwing up my email format

Aheho picture Aheho · Oct 29, 2008 · Viewed 59.8k times · Source

I'm sending an email using the dotnet framework. Here is the template that I'm using to create the message:

Date of Hire: %HireDate%
Annual Salary: %AnnualIncome%
Reason for Request: %ReasonForRequest%

Name of Voluntary Employee: %FirstName% %LastName%
Total Coverage Applied For:  %EECoverageAmount%
Guaranteed Coverage Portion: %GICoveragePortion%
Amount Subject to Medical Evident: %GIOverage%

When the messages is received in outlook, outlook tells me "Extra line breaks in this message were removed". And the message displays like this:

Date of Hire: 9/28/2001
Annual Salary: $100,000
Reason for Request: New Hire

Name of Voluntary Employee: Ronald Weasley Total Coverage Applied For:  $500,000 Guaranteed Coverage Portion: $300,000.00 Amount Subject to Medical Evident: $200,000

Note how Outlook incorrectly removes needed line breaks after the name, EECoverageAmount, etc...

It's important for the email recepients to get a correctly formatted email, and I have to assume that some of them use outlook 2003. I also can't assume they will know enough to shutoff the autoclean feature to get the message to format properly.

I have viewed these messages in other mail clients and they display correctly

some more information:

  • I am using UTF-8 BodyEncoding (msg.BodyEncoding = System.Text.Encoding.UTF8)
  • The msg.Body is being read from a UTF-8 encoded text file, and each line is terminated with a crlf.

Question: How do I change the format of the message to avoid this problem?

Answer

Jim Davis picture Jim Davis · Jan 12, 2009

You can also insert a tab character at the end of the line (just before the CR LF). This extra white space will be at the end of the line and hence not visible to user. You might prefer this to having to insert spaces on the left. Note that a single space is not enough (though perhaps multiple spaces would help, I don't know.)