| newline in PHP email scripts re: previous posts |
chriseccles2

msg:3807768 | 11:39 am on Dec 15, 2008 (gmt 0) | 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 ! - Chris
|
coopster

msg:3807829 | 2:16 pm on Dec 15, 2008 (gmt 0) | Welcome to WebmasterWorld, chriseccles2. 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.
|
jean123456

msg:3812418 | 8:35 pm on Dec 21, 2008 (gmt 0) | "I have found that '\r\n' often doesn't work with an Apache server." I have found that I need to use double quotes to make this work, that is use "\r\n"
|
|
|