Reputation: 103
I have the following .php file:
<?php
$to = "[email protected]";
$from = $_POST["from"];
$subject = $_POST["subj"];
$message = $_POST["body"];
$headers = "From: ".$from.
" X-Mailer: php";
if(mail($to, $subject, $message, $headers)){
header("Location: resume.html");
} else{
echo("<p>".$to." ".$from." ".$subject." ".$message." ".$headers."</p>");
}
?>
Every time it's called upon, it returns false. Any ideas?
Upvotes: 0
Views: 180
Reputation: 324600
Your headers are incorrectly formatted. You must have \r\n
between them, not a space as you appear to have here.
$headers = "From: ".$from."\r\n"
."X-Mailer: php";
Upvotes: 3