php - SMTP 服务器响应 : 550 - currently not permitted to relay 550-through this server

标签 php email smtp

我正在使用 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 。还有人推荐PHPMailerPEAR's Mail ,两者都能够执行 SMTP 身份验证。

关于php - SMTP 服务器响应 : 550 - currently not permitted to relay 550-through this server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5355919/

相关文章:

email - In-Reply-to 和 Reference 已添加到电子邮件标题中,但仍作为新邮件发送但不回复

java - 类和接口(interface)

php - CodeIgniter 的 CSV 导入库

php - 需要获取表,以便每一行都有键的主 ID (ZEND)

javascript - javascript可以根据表单内容自动发送电子邮件吗?

python - 用 python 发送电子邮件

php - android restful webservice将数据数组发送到php并在服务器中检索数据

android - 如何使用 Android Intent 发送 HTML 邮件

google-app-engine - Google Cloud(直接)传入 SMTP

c# - 邮件不以表格格式发送 C#