Why can't I receive emails if the email is sent? & Lt ;? Phprequireclass. phpmailer. php; try {$ mailnewPHPMailer (true); Newinstance, withexceptionsenabled $ bodyfile_get_contents?
Require 'class. phpmailer. php ';
Try {
$ Mail = new PHPMailer (true); // New instance, with exceptions enabled
$ Body = file_get_contents('contents.html ');
$ Body = preg_replace ('// \\\/', '', $ body); // Strip backslashes
$ Mail-> IsSMTP (); // tell the class to use SMTP
$ Mail-> SMTPAuth = true; // enable SMTP authentication
$ Mail-> Port = 25; // set the SMTP server port
$ Mail-> Host = "smtp.qq.com"; // SMTP server
$ Mail-> Username = "wanglintao_1@qq.com"; // SMTP server username
$ Mail-> Password = "12345in"; // SMTP server password
$ Mail-> IsSendmail (); // tell the class to use Sendmail
$ Mail-> AddReplyTo ("name@domain.com", "First Last ");
$ Mail-> From = "wanglintao_1@qq.com ";
$ Mail-> FromName = "wanglingtao ";
$ To = "wanglintao_1@163.com ";
$ Mail-> AddAddress ($ );
$ Mail-> Subject = "First PHPMailer Message ";
$ Mail-> AltBody = "To view the message, please use an HTML compatible email viewer! "; // Optional, comment out and test
$ Mail-> WordWrap = 80; // set word wrap
$ Mail-> MsgHTML ($ body );
$ Mail-> IsHTML (true); // send as HTML
$ Mail-> Send ()
Echo "Message has been sent ";
} Catch (phpmailerException $ e ){
Echo $ e-> errorMessage ();
}
?>
------ Solution --------------------
Are you sure you have activated SMTP/pop3 on QQ?
------ Solution --------------------
Check whether the email receiving program is running on your server.
------ Solution --------------------
Check whether the log sent by the server mail is usually in/var/log/maillog
------ Solution --------------------
Discussion
$ Mail-> Host = "smtp.qq.com"; // SMTP server
$ Mail-> Username = "wanglintao_1@qq.com"; // SMTP server username
$ Mail-> Password = "12345in"; // SMTP server password
====================================
Excuse me ......
------ Solution --------------------
Change the password to 126. Try gmail. Qq is not supported.