我正在使用 php mail() 通过 SMTP 发送电子邮件 但是当我从 [email protected] 发送邮件时,我遇到以下错误,
Warning: mail() [function.mail]: SMTP server response: 550-(ABC-7d3b78ff) [117.98.220.45]:1747 is currently not permitted to relay 550-through this server. Perhaps you have not logged into the pop/imap server 550-in the last 30 minutes or do not have SMTP Authentication turned on in your 550 email client.
这是我的代码问题还是我需要在服务器端进行更改?
这是我的代码:
$header .= "\r\nMIME-Version: 1.0";
$header .= "\r\nContent-type: text/html; charset=iso-8859-1\r\n";
$from = $row["fromid"];
$to = $row["email_addr"]; // <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7b1a19183b021a13141455181416" rel="noreferrer noopener nofollow">[email protected]</a> sending to other than same domain mail
$subject = $row["subject"];
mail($to,$subject,$body,$header);
最佳答案
看起来您服务器上的 PHP 已配置为在使用 mail()
时与 SMTP 服务器通信。该错误消息表明您的 SMTP 服务器希望您执行直接身份验证,或者执行 POP-before-SMTP 身份验证。如果您使用共享托管,我赞扬您的网络托管提供商如此聪明。
正如评论中提到的SwiftMailer是一个功能强大、易于使用的邮件库,其中包括 the ability to perform SMTP authentication 。还有人推荐PHPMailer或PEAR's Mail ,两者都能够执行 SMTP 身份验证。
关于php - SMTP 服务器响应 : 550 - currently not permitted to relay 550-through this server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5355919/