Here is my code:
$body = "Name:{$name}".PHP_EOL;
$body .= "Phone:".$phone.PHP_EOL;
$body .= "Email:".$email."\n\n";
$body .= "Comments:".$comments."\n\n";
$headers = 'From: MAILER <'.$emailTo.'>' . "\r\n" . 'Reply-To: '. $email."\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8";
mail($emailTo, "New message", $body, $headers);
as you can see I’ve tried to use, \r\n\, \n\n, PHP_EOL etc…
the only way it works is when i removing my “content-type” header.
anyone have an idea for why is it like that?!
Since you are sending HTML email you need to use
<br>to set the line breaks. Well that or wrap everything in<pre></pre>tags to honor the \n. IF you don’t need HTML in the output just set your content to'text/plain', and the line breaks would show up.Since it isn’t multi-part try adding
MIME-Version: 1.0to the headers. That might help with the content type.