How do I format an email from a PHP form? Adding line breaks. HELP?

DzSoundNirvana

New member
\n new line feed
\r carriage return


change:
$message = 'From: '.$name.'Email: '.$mailFrom.'Message: '.$message_text;

to:

$message = 'From: '.$name.' \n\rEmail: '.$mailFrom.'\n\rMessage: '.$message_text;


* " " (ASCII 32 (0x20)), an ordinary space.
* "\t" (ASCII 9 (0x09)), a tab.
* "\n" (ASCII 10 (0x0A)), a new line (line feed).
* "\r" (ASCII 13 (0x0D)), a carriage return.
* "{rss:Content}" (ASCII 0 (0x00)), the NUL-byte.
* "\x0B" (ASCII 11 (0x0B)), a vertical tab.
 
First off, I'm on a short deadline. Help would be appreciated

I'm building a website, and it includes a php message form. After being filled out, it sends the message to my email address.

Here is the PHP snippet:
<?php

$mailTo = '[email protected]';
$name = htmlspecialchars($_POST['Name']);
$mailFrom = htmlspecialchars($_POST['Email']);
$subject = 'Message from your site';
$message_text = htmlspecialchars($_POST['Message']);

$message = 'From: '.$name.'Email: '.$mailFrom.'Message: '.$message_text;

mail($mailTo, $subject, $message);
?>

The PROBLEM however...is that the messages come to my email looking like this....

From: Jayson WilliamsEmail: [email protected]: blah.

As you can see, its a bit difficult to read. How do Insert line breaks so that when the email comes in, it will look more or less like this:

From: Jayson Williams
Email: [email protected]
Message: blah.


Help please...will award points!
 
Back
Top