tags:

views:

23

answers:

3

Hi,

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

+1  A: 

because it's \r\n

sathia
about <br/> it would make sense only if the mail is sent as HTML otherwise it will only print those 5 characters
sathia
+1  A: 

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!
";
sombe
+1  A: 

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 4

In81Vad0