I\'m using the following to send an email:
<?php ....
$message = "Hi ".$fname.", \r\n Your entries for the week of "
.$weekof." have been reviewed. \r\n Please login and View Weekly reports to see the report and comments. \r\n Thanks, \r\n".$myname;
mail($to, $subject, $message, $from);
?>
Not an answer to the question, but may be of help to someone.
Send a HTML message, and instead of \n, use <BR>
.
And use <PRE></PRE>
or CSS for preformatted text, thus translating \n to actual new lines.
$headerFields = array(
"From: who@are.you",
"MIME-Version: 1.0",
"Content-Type: text/html;charset=utf-8"
);
mail($to, $subj, $msg, implode("\r\n", $headerFields));
Try to change your '
to "
- php interprets a string inside single quotes as literals, whereas with quotes ("
) it will expand the \r\n
to what you want.
More information: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single