I am trying to send email using mail() in php. I need the message to be formatted or at least allow line breaks.
$mail = mail(WEBMASTER_EMAIL, $subject, $me
because it's \r\n
It's \r\n, as in backslash not forward slash.
Also you can try it like this:
$message = "
Hi!
This is one line.
And this is another.
Bye!
";
you should set the content type of the mail (read: tell php you're sending a html e-mail) http://php.net/manual/en/function.mail.php
it's all explained in Example #5 Sending HTML email.
To format message body you should use \n, as follow:
$message = "Hi!
\nThis is one line.
\nAnd this is another.
\nBye!";
This is formatting your message body.
It's the solution I got after waisting too many time and It's working perfectly.
echo "line 1".PHP_EOL."line 2".PHP_EOL;
If you're planning to show the result in a browser then you have to use "<br>"
.