phpmailer – SMTP – >错误:服务器不接受RCPT
发布时间:2020-12-13 18:01:31 所属栏目:PHP教程 来源:网络整理
导读: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.gm
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;..... (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |