Just browsing through older posts, I noticed the advice given regarding the insertion of newline in PHP-generated email. - I have found that '\r\n' often doesn't work with an Apache server. This causes hours of frustration for anyone trying to figure why their generated mail is always on one continuous line ! - A better solution is always to use: $messageText .= $messageText ."<br>";
for each line break needed.
Quite why the HTML tag works without breaking out of PHP is beyond my ken, but it does, every time !
I believe you are confused about two very different situations here. The mail headers do indeed require separation by newline, as per the mail RFC. Therefore, the
\r\n must be coded properly.
However, if you are sending out HTML formatted mail, the only way to get your content separated is to use block elements in your HTML that are going to "push" the next block of information below the previous. An alternative is to wrap your $messageText in a set of HTML <pre></pre> tags and code your newlines that way.
To summarize, there is a difference between coding the message headers and the message content (body) itself.