Plain text email not wrapping correctly
It has been a while!
Now that summer have finally arrived in the UK I thought I should come out of my blogging hibernation.
Here is an interesting one to start with.
At work i have been developing a system that requires a log to be emailed to users. For this particular application I was developing in Delphi but the same problem seems to occur with many other languages.
The problem was that any emails that were sent from my system were stripped of there line breaks. At first I thought that the issue was in Delphi. After a bit of debugging I found that delphi was send the information correctly as separate lines. Even the outlook notification was displaying the line breaks correctly. However when the full email was opened all text appeared on one continious line.
After a frustrating few hours I found a stackoverflow post.
Some of the solutions suggested were:
Hope this helps someone.
Now that summer have finally arrived in the UK I thought I should come out of my blogging hibernation.
Here is an interesting one to start with.
At work i have been developing a system that requires a log to be emailed to users. For this particular application I was developing in Delphi but the same problem seems to occur with many other languages.
The problem was that any emails that were sent from my system were stripped of there line breaks. At first I thought that the issue was in Delphi. After a bit of debugging I found that delphi was send the information correctly as separate lines. Even the outlook notification was displaying the line breaks correctly. However when the full email was opened all text appeared on one continious line.
After a frustrating few hours I found a stackoverflow post.
Some of the solutions suggested were:
- Convert the email to HTML format so that '
' breaks can be inserted when required. - Add extra \r\n at the end of each line
- Add %0D%0A at the end of each line
- Add a (.) dot at the end of each line.
- Re instated line breaks in Outlook by going into Format -> Unwrap text when viewing the email.
Hope this helps someone.
Comments