IsSMTP();$mail->Host="smtp.">
时间:2021-07-01 10:21:17 帮助过:17人阅读
//定义一个mail发送函数
function sendMail($address,$title,$message){
//导入mail类文件
require("./PHPMailer/class.phpmailer.php");
//创建mail对象
$mail=new PHPMailer();
$mail->IsSMTP();
$mail->Host="smtp.163.com";
$mail->SMTPAuth =true;
$mail->Username= "18501773419@163.com";
$mail->Password= "x x x x x x";
$mail->From = "18501773419@163.com";
$mail->FromName= "乐分享weshare";
$mail->AddAddress($address);
$mail->IsHTML(true);
$mail->Subject=$title;
$mail->Body =$message;
if(!$mail->Send()){
return true;
}else{
return false;
}
}
sendMail("18501773419@163.com","测试","你好我是peace");
?>
PHP使用phpmailer发送邮件,提示没有通过验证(SMTP Error: Could not authenticate. ),注释掉验证代码之后,又显示The following From address failed:?
//定义一个mail发送函数
function sendMail($address,$title,$message){
//导入mail类文件
require("./PHPMailer/class.phpmailer.php");
//创建mail对象
$mail=new PHPMailer();
$mail->IsSMTP();
$mail->Host="smtp.163.com";
$mail->SMTPAuth =true;
$mail->Username= "18501773419@163.com";
$mail->Password= "x x x x x x";
$mail->From = "18501773419@163.com";
$mail->FromName= "乐分享weshare";
$mail->AddAddress($address);
$mail->IsHTML(true);
$mail->Subject=$title;
$mail->Body =$message;
if(!$mail->Send()){
return true;
}else{
return false;
}
}
sendMail("18501773419@163.com","测试","你好我是peace");
?>
PHP使用phpmailer发送邮件,提示没有通过验证(SMTP Error: Could not authenticate. ),注释掉验证代码之后,又显示The following From address failed:?
邮箱需要开启SMTP服务,可以在邮箱中设置~ 163邮箱应该会单独分配SMTP的密码
(PS: 使用QQ邮箱发送要注意端口号不是默认的25!!!)
class.smtp.php没require啊
看下环境的log,并且提高下phpmailer的debug等级看下