SMTP -> ERROR: RCPT not accepted from server

断了今生、忘了曾经 提交于 2019-12-23 08:54:57

问题


 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;
}
}

Trying to send mail through phpmailer with smtp. turning on debug gives me error:

SMTP -> ERROR: RCPT not accepted from server: 550 SMTP AUTH is required for message submission on port 587 SMTP -> ERROR: DATA command not accepted from server: SMTP -> NOTICE: EOF caught while checking if connected


回答1:


It looks like port 587 is blocked. Try using

$mail= new PHPMailer(); 
$mail->IsSMTP(); 
$mail->SMTPAuth= true; 
$mail->SMTPSecure= "ssl"; 
$mail->Host= "smtp.gmail.com"; 
$mail->Port= 465;.....


来源:https://stackoverflow.com/questions/15453197/smtp-error-rcpt-not-accepted-from-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!