学习php发送邮件的时候报错SMTP Error: Could not authenticate.是什么原因?
<?phpinclude"class.phpmailer.php";functionsend_mail($frommail,$tomail,$subject,$body,...
<?php
include "class.phpmailer.php";
function send_mail($frommail,$tomail,$subject,$body,$ccmail,$bccmail){
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug;
$mail->Host = "smtp.qq.com";
$mail->SMTPAuth = true;
$mail->Port = 25;
$mail->Username = "869851110@qq.com";
$mail->Password = "****";
$mail->AddReplyTo($frommail, 'tankzhang');
$mail->AddAddress($tomail);
$mail->SetFrom($frommail, 'tankzhang');
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->MsgHTML($body);
if(!$mail->Send())
{
echo "邮件发送失败. <p>";
echo "错误原因: " . $mail->ErrorInfo;
exit;
}else{
echo "success";
}
}
$result= send_mail("869851110@qq.com","1151978221@qq.com","test","test","","");
?> 展开
include "class.phpmailer.php";
function send_mail($frommail,$tomail,$subject,$body,$ccmail,$bccmail){
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug;
$mail->Host = "smtp.qq.com";
$mail->SMTPAuth = true;
$mail->Port = 25;
$mail->Username = "869851110@qq.com";
$mail->Password = "****";
$mail->AddReplyTo($frommail, 'tankzhang');
$mail->AddAddress($tomail);
$mail->SetFrom($frommail, 'tankzhang');
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->MsgHTML($body);
if(!$mail->Send())
{
echo "邮件发送失败. <p>";
echo "错误原因: " . $mail->ErrorInfo;
exit;
}else{
echo "success";
}
}
$result= send_mail("869851110@qq.com","1151978221@qq.com","test","test","","");
?> 展开
展开全部
这个是提示你的邮箱需要认证,你这个问题 我前几天刚研究过,具体操作和解决办法可以去参考此文章
详细参考地址http://www.itnet.org.cn/news452.html,望采纳!
详细参考地址http://www.itnet.org.cn/news452.html,望采纳!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询