PHP使用phpmailer发送邮件?
<?php
//定义一个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= "[email protected]";
$mail->Password= "x x x x x x";
$mail->From = "[email protected]";
$mail->FromName= "乐分享weshare";
$mail->AddAddress($address);
$mail->IsHTML(true);
$mail->Subject=$title;
$mail->Body =$message;
if(!$mail->Send()){
return true;
}else{
return false;
}
}
sendMail("[email protected]","测试","... ;
?>
PHP使用phpmailer发送邮件,提示没有通过验证(SMTP Error: Could not authenticate. ),注释掉验证代码之后,又显示The following From address failed:?
Khoomei
9 years, 2 months ago