Why can't I receive a locally sent email using phpmailer?-php Tutorial

Source: Internet
Author: User
Why can't I receive $ mail $ user_mail; $ randvalrandStr (6, & quot; ALL & quot;); $ randvalmd5 ($ randval); & nbsp; setcookie (mail_code2, $ randval, time () + 17 why can't I receive the mail successfully sent by phpmailer locally?
$ Mail = $ user_mail;
$ Randval = randStr (6, "ALL ");
$ Randval = md5 ($ randval );
Setcookie ('mail _ code2', $ randval, time () + 172800 ,'/');
$ Code = $ mail. '_'. $ randval;
$ Code = base64_encode ($ code );
Setcookie ('mail _ form_code ', $ code, time () + 172800 ,'/');
$ Url = site_url ('Forget/reset/mail/'. $ mail.'/e/'. $ randval );
$ Body = $ this-> load-> view ('mail/content2', array ('URL' => $ url), true );
$ Body = eregi_replace ("[\]", '', $ body );
$ This-> phpmail-> IsSMTP ();
$ This-> phpmail-> Host = "smtp.qq.com ";
$ This-> phpmail-> SMTPAuth = true;
$ This-> phpmail-> Host = "smtp.qq.com ";
$ This-> phpmail-> Port = 25;
$ This-> phpmail-> Username = "[email protected]";
$ This-> phpmail-> Password = "asdfg314159 ";
$ This-> phpmail-> SetFrom ([email protected] ', 'First last ');
$ This-> phpmail-> AddReplyTo ("[email protected]", "First Last ");
$ This-> phpmail-> MsgHTML ($ body );
$ Address = $ mail;
Echo $ address;
$ This-> phpmail-> AddAddress ($ address, "hello world! ");
// $ This-> phpmail-> Send ();
If (! $ This-> phpmail-> Send ()){
Echo "Mailer Error:". $ this-> phpmail-> ErrorInfo;
} Else {
Echo "Message sent! ";
}
Exit ();
Return true;

------ Solution --------------------
Phpmailer has the debug mode. when you enable the debug mode to report errors, you will know where the problem is.

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.