0

Hi, I've been having trouble with a form script that sends an e-mail but doesn't format the information correctly:

$formcontent="VISITOR NAME: $name\\n\\nFEEDBACK: $message";
$recipient = "facadmin@frontandcover.com";
$subject = "Contact Form";
$mailheader = "From: $email\\r\\n";
$mailheader .= "Reply-To: $email\\r\\n";
$mailheader .= "MIME-Version: 1.0\\r\\n";
if(strlen($message)>0){
mail($recipient, $subject, $formcontent, $mailheader) or die("Failure!");
echo "Your Message was Sent, <a href='index.php'><--Back</a>";
} else { echo "No E-mail was sent because your message contained no content. <a href='index.php'><--Back</a>"; }

For instance, if I enter my name as FrontAndCover.com, from e-mail qwerty@frontandcover.com with the content "Hello this is my message" I get an e-mail that looks like this:

From: qwerty@frontandcover.com\r\nReply-To:qwerty@frontandcover.com\r\nMIME-Version: 1.0\r\n
To: recipient-addr@frontandcover.com
Subject: Contact Form
Message Body:
VISITOR NAME:
FrontAndCover.com\n\nFEEDBACK: Hello this is my message

So I'm trying to figure out how to get this to send a normal looking e-mail.

3
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by Goldfinch
1

your return and line feed characters have double slashes which causes them to be ignored should be \r\n

1

I can tell you what I would try. I would first try it without escaping the backslashes (i.e. \r\n instead of \\r\\n). Then try just using \n (without \r). If neither of those worked then I would try replacing the newlines with <br> (for HTML email).

0

according to the test I just did, removing the second backslashes worked exactly right

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.