php - Getting warning message in Gmail Account when I send email by using phpmailer() -
i using phpmailer() send email website. when it's sent email see following warning message.
i can't understand why it's showing , how can fix error message. can tell me ?
following code :
<?php require_once("mail/phpmailerautoload.php"); $mail = new phpmailer; $mail->setfrom($email); $mail->addreplyto('toemail@gmail.com', 'first last'); $mail->addaddress('toemail@gmail.com', 'first last'); $mail->subject = 'phpmailer mail() test'; $mail->msghtml(file_get_contents('mail/contents.html'), dirname(__file__)); $mail->altbody = 'this plain-text message body'; $mail->addattachment('mail/images/phpmailer_mini.png'); if (!$mail->send()) { echo "mailer error: " . $mail->errorinfo; } else { echo "message sent!"; } ?>
easy, read spf dns record.
when send , email, services gmail check if sender ip same domain of email, example:
you send email "foo@gmail.com" "bar@hotmail.com". server ip 1.1.1.1
hotmail receives email "foo@gmail.com" check if gmail.com ip (2.2.2.2) same server (1.1.1.1). answer no, email marked spam.
to avoid email marked spam, use phpmailer using real google account , provide phpmailer user , password send email.
i tried explain situation easy on point 2. real situation bit complicated logic same, check ip sender , origin. read spf (and dkim) because looking :) http://en.wikipedia.org/wiki/sender_policy_framework
Comments
Post a Comment