SMTP -> ERROR: RCPT not accepted from server

匿名 (未验证) 提交于 2019-12-03 00:48:01

问题:

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


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