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.

enter image description here

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:

  1. you send email "foo@gmail.com" "bar@hotmail.com". server ip 1.1.1.1

  2. 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.

  3. 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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -