1
I am using iRedMail and I have a perfectly setup of mail server.
www.mail-tester.com gives me 10/10.
However when I use this code to sent automatic emails:
$subject = "Subject here";
$message = "Hello dear $name,<br>
We would like to inform you that the service <b>$service</b> is cancelled!<br><br>
You will no longer be invoiced for this service at the first of the month.<br>
Please if you have any questions do not hesitate to contact us!<br>";
$headers = 'From: Order Received <noreply@MYDOMAIN.com>' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=UTF-8' . "\r\n" .
'Reply-To: Order Received <noreply@MYDOMAIN.com>' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
mail($email, $subject, $message, $headers);
Note that I have replaced MYDOMAIN.com
with my actual domain. Here I place an edited sample.
Do you have any idea why my emails go to SPAM when I am not in any blacklists ?
1Why are you base64 encoding the subject line? – DavidPostill – 2016-03-29T18:49:15.240