Why can't I receive emails if the email is sent?

Source: Internet
Author: User
Tags word wrap
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.