SMTP 服务器响应:550 - 当前不允许通过此服务器中继 550
我正在使用 php mail() 通过 SMTP 发送电子邮件 但是,当我从 [email protected] 发送邮件时,出现以下错误,
警告:mail() [function.mail]:SMTP 服务器响应:550-(ABC-7d3b78ff) [117.98.220.45]:1747 当前不允许通过此服务器中继 550-。也许您在过去 30 分钟内没有登录 pop/imap 服务器 550,或者没有在您的 550 电子邮件客户端中打开 SMTP 身份验证。
这是我的代码的问题还是我应该在服务器端进行更改?
这是我的代码:
$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"]; // [email protected] sending to other than same domain mail
$subject = $row["subject"];
mail($to,$subject,$body,$header);
I am using php mail() to send email, via SMTP
But when i send mail from [email protected], I am getting below error,
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.
Is this issue with my code or should i need to change on server side?
Here is my code :
$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"]; // [email protected] sending to other than same domain mail
$subject = $row["subject"];
mail($to,$subject,$body,$header);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的服务器上的 PHP 似乎已配置为在使用
mail()
时与 SMTP 服务器通信。该错误消息表明您的 SMTP 服务器希望您执行直接身份验证,或者执行 POP-before-SMTP 身份验证。如果您使用共享托管,我赞扬您的网络托管提供商如此聪明。正如评论中提到的 SwiftMailer 是一个功能强大、易于使用的邮件库,其中包括 执行 SMTP 身份验证的能力。有些人还推荐 PHPMailer 或 PEAR 的 Mail,两者都能够执行 SMTP 身份验证。
It looks like PHP on your server is configured to speak to an SMTP server when using
mail()
. That error message indicates that your SMTP server expects you to either perform direct authentication, or for you to perform a POP-before-SMTP authentication. If you are on shared hosting, I commend your web hosting provider for being so clever.As mentioned in the comments SwiftMailer is a powerful, easy to use mailing library that includes the ability to perform SMTP authentication. Some people also recommend PHPMailer or PEAR's Mail, both of which are also able to perform SMTP auth.
这个问题可以解决,只需在你的 php 中添加以下行:
因此你的代码将变成:
This problem can be solved, by simply adding the follwing line in your php:
Thus your code will become: