Email-phpmailer use NetEase 126 to send mail questions

Source: Internet
Author: User
Recently using Phpmailer library to connect NetEase's smtp.126.com mail service send mail always return connection failed
Mailer Error: SMTP connect() failed.
The same is true for the Swiftmailer library.
This is the use of the new NetEase account will have problems, because the new NetEase account needs to open the client authorization code to use the SMTP service. The old account is not the problem.

How do I use this authorization code to connect with the SMTP of NetEase? Or are there other ways to troubleshoot connection failures?

/**这是网上摘抄的代码 使用其他帐号可以正常使用的,问题同上*//*** phpmailer发送邮件实例* 发送网易邮箱126.com* edit www.jbxue.com*/$mail= new PHPMailer();$body= "发送邮件成功";//采用SMTP发送邮件$mail->IsSMTP();//邮件服务器$mail->Host       = "smtp.126.com";$mail->SMTPDebug  = 0;//使用SMPT验证$mail->SMTPAuth   = true;//SMTP验证的用户名称$mail->Username   = "longmonhau";//SMTP验证的秘密$mail->Password   = "?";//密码//设置编码格式$mail->CharSet  = "utf-8";//设置主题$mail->Subject    = "测试";//$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";//设置发送者$mail->SetFrom('longmonhau@126.com', 'test');//采用html格式发送邮件$mail->MsgHTML($body);//接受者邮件名称$mail->AddAddress("1307995200@qq.com", "test");//发送邮件if(!$mail->Send()) {  echo "Mailer Error: " . $mail->ErrorInfo;} else {  echo "Message sent!";}

Reply content:

Recently using Phpmailer library to connect NetEase's smtp.126.com mail service send mail always return connection failed
Mailer Error: SMTP connect() failed.
The same is true for the Swiftmailer library.
This is the use of the new NetEase account will have problems, because the new NetEase account needs to open the client authorization code to use the SMTP service. The old account is not the problem.

How do I use this authorization code to connect with the SMTP of NetEase? Or are there other ways to troubleshoot connection failures?

/**这是网上摘抄的代码 使用其他帐号可以正常使用的,问题同上*//*** phpmailer发送邮件实例* 发送网易邮箱126.com* edit www.jbxue.com*/$mail= new PHPMailer();$body= "发送邮件成功";//采用SMTP发送邮件$mail->IsSMTP();//邮件服务器$mail->Host       = "smtp.126.com";$mail->SMTPDebug  = 0;//使用SMPT验证$mail->SMTPAuth   = true;//SMTP验证的用户名称$mail->Username   = "longmonhau";//SMTP验证的秘密$mail->Password   = "?";//密码//设置编码格式$mail->CharSet  = "utf-8";//设置主题$mail->Subject    = "测试";//$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";//设置发送者$mail->SetFrom('longmonhau@126.com', 'test');//采用html格式发送邮件$mail->MsgHTML($body);//接受者邮件名称$mail->AddAddress("1307995200@qq.com", "test");//发送邮件if(!$mail->Send()) {  echo "Mailer Error: " . $mail->ErrorInfo;} else {  echo "Message sent!";}

In my opinion, the client authorization code is like an alternative to a password.

Reference Link: http://help.163.com/14/0923/22/A6S1FMJD00754KNP.html

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