All emails that my site is sending are going to SPAM box in Gmail (I haven't tested other email servers).
I'm sending emails through Gmail using my own domain (via Google Apps). I send the emails using the PHPMailer library:
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "[email protected]";
$mail->Password = "mypassword";
$mail->From = "[email protected]";
$mail->FromName = $websiteName;
$mail->Subject = $subject;
$mail->AddAddress($to, "Client");
if ($html) {
$mail->MsgHTML($content);
$mail->AltBody = strip_tags($content);
$mail->IsHTML(true);
} else {
$mail->Body = $content;
}
if (isset($options['content-type'])) {
$mail->ContentType = $options['content-type'];
}
if (isset($options['charset'])) {
$mail->CharSet = $options['charset'];
}
return $mail->Send();
The email is sent as expected, but always falls into SPAM box. It happens in emails that contain HTML and in emails that are raw text like this:
Hello John Smith,
Thank you very much for trusting us.
To finish your purchase you should deposit XX USD to the account number:
IBAN XXXX - XXXX XXXX XX XX XXXXXX
Once we receive your transfer, we will activate your license and send all documents by e-mail (a copy of the contract, invoice, user guide concerning the application). You have 15 days to review all the material and the application itself and if you are not fully satisfied with the product you purchased, we will refund your money.
If you need some agent's help you can reply this email.
Greetings
Well this message may be contains some words that could activate the SPAM filter, but it also happens with messages like this:
Hello
You have a new message in your inbox:
Meeting about next holidays (17:40-18:20).
We hope to see you soon!
What's wrong? What's the best strategy to send emails through gmail without being penalized?
ensure you have an SPF record associated with your domain, have a look here : http://support.google.com/a/bin/answer.py?hl=en-uk&hlrm=en&answer=33786