All emails sent by my site are sent to the SPAM field in Gmail (I have not tested other mail servers).
I send letters through Gmail using my own domain (through Google Apps). I send letters 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 = " myuser@example.com "; $mail->Password = "mypassword"; $mail->From = " noreply@example.com "; $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 letter is sent as expected, but always falls into the SPAM field. This occurs in emails that contain HTML and in emails that are raw text as follows:
Hi John Smith
Thank you very much for trusting us.
To complete the purchase, you must deposit 20 USD to the account number:
IBAN XXXX - XXXX XXXX XX XXXXXXX
As soon as we receive your transfer, we will activate your license and send all documents by e-mail (copy of the contract, invoice, user manual regarding the application). You have 15 days to review all the material and the application itself, and if you are not completely satisfied with the product you purchased, we will refund your money.
If you need help from an agent, you can reply to this email.
Hello
Well, this message may contain a few words that could activate the SPAM filter, but this 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!
http://example.com/
What happened? What is the best strategy for sending emails via gmail without penalty?