Spunky Posted July 10, 2014 Share Posted July 10, 2014 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 More sharing options...
davej Posted July 10, 2014 Share Posted July 10, 2014 Maybe... $MESSAGE_BODY = "Name: ".$_POST["name"]."rn"; Link to comment Share on other sites More sharing options...
Don Jajo Posted July 10, 2014 Share Posted July 10, 2014 Coding an email body I don't use n or nr. I just hit the enter key it will also reflect in the mail Link to comment Share on other sites More sharing options...
justsomeguy Posted July 10, 2014 Share Posted July 10, 2014 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. Link to comment Share on other sites More sharing options...
Spunky Posted July 10, 2014 Author Share Posted July 10, 2014 Maybe... $MESSAGE_BODY = "Name: ".$_POST["name"]."rn"; Maybe not... 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. 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. I'd gotten this code from elsewhere, so still getting to understand it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now