I'm trying to send an email with PHP.
This is my code:
$subject = 'You got mail';
$message = 'This is one line.\n' .
'This is another.';
mail('your@email.com', $subject, $message);
When I receive the mail, the two lines of the message body appear as one line, with the newline \n
given as part of the message text:
This is one line.\nThis is another.
Why is that, and how can I get my lines to break?
Solution:
ôkio's answer is correct. But instead of using double quotes, I now use the predefined end-of-line variable:
$message = 'This is one line.' . PHP_EOL .
'This is another.';
` and set the headers to send the email as HTML. – Shankar Narayana Damodaran May 07 '14 at 12:18