Jump to content

\r\n not working


Spunky

Recommended Posts

Could anyone tell me why this code is not putting the $MESSAGE_BODY content on a new line when viewed in the email?

<?php      $ToEmail = 'email';       $EmailSubject = 'Emergency Contact Form';       $mailheader = "From: ".$_POST["name"]."rn";       $mailheader .= "Content-type: text/html; charset=iso-8859-1"."rn";       $MESSAGE_BODY .= "Name: ".$_POST["name"]."rn";       $MESSAGE_BODY .= "Telephone: ".$_POST["telephone"]."rn";       $MESSAGE_BODY .= "Message: ".nl2br($_POST["message"])."rn";       mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");?>

Thanks

Link to comment
Share on other sites

 

Maybe...

 $MESSAGE_BODY = "Name: ".$_POST["name"]."rn"; 

 

Maybe not... :happy0046:

 

Coding an email body I don't use n or nr. I just hit the enter key it will also reflect in the mail :)

 

Not clean code but thanks. :Pleased:

 

If you want it to show line breaks then you need to send text/plain instead of text/html. If you want to send an HTML email then use <br> instead of a line break.

 

 

I changed it to text/plain. That worked, thank you. :good: I'd gotten this code from elsewhere, so still getting to understand it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...