Is my mailbox set up correctly?
Is the following "From" header included?
// 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 <mail@mailmaster.com>' . "\r\n";
if(sendEmailNow($email, $subject, $body, $headers)){
I am getting an error from my mail server. It says "Mail from error: Syntax error".
Thanks everyone for any help.
Update
I have disabled SendEmailNow feature until below and I am getting 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
The problem has been resolved. I am running this on a Windows machine using PHP 5. Like the correct answer and comments have been made. Some mail servers have problems understanding what I had earlier. But what worked for me was this:
$headers .= 'From: mail@mailmaster.com' . "\r\n";
source to share
Not sure if it helps, but this is what the output headers look like in my Python application in plain text:
Content-Type: multipart / alternative;
boundary = "10.254.26.130.1.1364.1241389770.060.1"
From: User1 < user1@domain1.com >
To: User2 < user2@domain1.com >, User3 < user3@domain.com >
Subject: Actual subject
MIME-Version: 1.0
--10.254.26.130.1.1364.1241389770.060.1
Content-Type: text / plain;
charset = "us-ascii"
Content-Transfer-Encoding: quoted-printable
actual text content starting here ...
Again, not knowing all the content / headers is hard to tell, but I would assume either a) you left out the CRLF before the content, or b) one of the previous headers missed its CRLF.
Sorry if this takes you in a wildly wrong direction. :)
source to share