Here’s the script:
<?php
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
$recipient = "me@christianselig.com";
$subject = "Message From Website";
$body = "[From: " . $name . "]\r\n\r\n" . $message;
$headers = "From: " . $email . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$success = mail($recipient, $subject, $body, $headers);
echo $success;
?>
On this page: christianselig.com/contact.html
My message will send without any linebreaks. I have it set to separate the [From: xxx] section from the message with a double linebreak, so it should look like this:
[From: John]
Hey.
But it doesn’t.
If I make the message multiple lines long, it also concatenates them on one line. How do I prevent this behaviour? My code used to allow it, but I broke it somehow…
Because you’re sending it with an html formatting. Try: