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, $message,
"From: ".$name." <".$email.">/r/n"
."Reply-To: ".$email."/r/n"
."X-Mailer: PHP/" . phpversion());
Do i need to provide "< br/>" tags in the $message or /r/n. Tried both but they came in as
or /r/n and not line breaks
Thanks Prady
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With