gpt4 book ai didi

phpmailer - SMTP -> 错误 : RCPT not accepted from server

转载 作者:行者123 更新时间:2023-12-04 12:33:33 24 4
gpt4 key购买 nike

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

尝试使用 smtp 通过 phpmailer 发送邮件。
打开调试会给我错误:

SMTP -> 错误:服务器不接受 RCPT:550 SMTP AUTH 需要在端口 587 上提交邮件

最佳答案

看起来 587 端口被阻止了。尝试使用

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

关于phpmailer - SMTP -> 错误 : RCPT not accepted from server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15453197/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com