phpmailer – SMTP – >错误:服务器不接受RCPT

前端之家收集整理的这篇文章主要介绍了phpmailer – SMTP – >错误:服务器不接受RCPT前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
require("PHPmailer.inc.PHP");

class sendmail
{
public static function sendAccountActivateMail($to,$subject,&message)
{
    $flg = false;
    try
{
$mail= new PHPMailer(); 
$mail->IsSMTP(); 
$mail->SMTPAuth= true; 
$mail->SMTPSecure= "tls"; 
$mail->Host= "smtp.gmail.com"; 
$mail->Port= 587; 
$mail->Username= "xxx@mydomain.com"; 
$mail->Password= "xxxxxx"; 
$mail->AddReplyTo("info@mydomain.com"); 
$mail->From= "info@mydomain.com"; 
$mail->FromName= "Website"; 
$mail->Subject= $subject; 
$mail->WordWrap= 50; 
$mail->Body = $message; 
$mail->AddAddress($to); 
$mail->Send(); 
}
catch(Exception $e)
    {
        $flg = false;
    }
    return $flg;
}
}

尝试通过PHPmailer发送邮件与smtp.
打开调试给我错误

SMTP – >错误:服务器不接受RCPT:550端口587 SMTP上提交邮件需要SMTP AUTH – >错误:服务器不接受DATA命令:SMTP – >注意:检查是否已连接时捕获了EOF

看起来端口587被阻止了.尝试使用
$mail= new PHPMailer(); 
$mail->IsSMTP(); 
$mail->SMTPAuth= true; 
$mail->SMTPSecure= "ssl"; 
$mail->Host= "smtp.gmail.com"; 
$mail->Port= 465;.....

猜你在找的PHP相关文章