Support
Forums

Re: sending email as html messes up formatting

Hi,
In text mode the receiver will interpret textual line endings, so if you have a "\n"  (ASCII 10) in your text, it will show a line break. In html mode however, whitespace (i.e. spaces, newlines, tabs) tends to be mangled according to "html"'s idea of formatting and can't be relied upon. To guarantee a line break you will need to insert HTML into your output. There are a number of ways to get a line break, in your case the easiest is probably to insert a "< br / >" into your output instead of a "\n". ...
Hi,
In text mode the receiver will interpret textual line endings, so if you have a "\n"  (ASCII 10) in your text, it will show a line break. In html mode however, whitespace (i.e. spaces, newlines, tabs) tends to be mangled according to "html"'s idea of formatting and can't be relied upon. To guarantee a line break you will need to insert HTML into your output. There are a number of ways to get a line break, in your case the easiest is probably to insert a "< br / >" into your output instead of a "\n". ...

About the author

Mad Penguin

Mad Penguin is a Linux forum administrator and moderator.