Reputation:
I am making a contact for a website and I am having issues. I am testing with XAMPP currently, using it's sendmail. I keep getting the error:
Message is missing sender's address
Here is the PHP Header Code:
//email headers
$headers = 'From: \""' .$email . '\r\n'. 'Reply-To' .
$email. "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $subject, $message, $headers);
I can't figure out the issue. Thanks
Upvotes: 2
Views: 10793
Reputation: 10583
You are escaping the double quote in headers, when it does not need to be escaped which will lead to you having two double quotes. Change your code to
$headers = 'From: ' .$email . "\r\n".
'Reply-To: ' . $email. "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $subject, $message, $headers);
Upvotes: 5