Hello all,
Is the following "From" header incorect?
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: Mail Master <[email protected]>' . "\r\n";
if(sendEmailNow($email, $subject, $body, $headers)){
I get the error from my mail server. It says "Mail from error: Syntax error".
Thanks all for any help.
Update
I have stripped down the SendEmailNow function to the below and I get the same error:
//send an email
function sendEmailNow($email, $subject, $body, $headers){
if (mail($email, $subject, $body, $headers)) {
##check email
##code to say email sent - compare with the number registered
return true;
}
else {
##code to report an error
return false;
}
}
Update 2
Problem solved. I am running this on a windows machine using PHP 5. Like the correct answer chosen and the comments have said. Some mail servers have trouble understanding what I had previously. But what worked for me was this:
$headers .= 'From: [email protected]' . "\r\n";