SMTP 服务器响应:550 - 当前不允许通过此服务器中继 550

发布于 2024-10-23 19:44:58 字数 874 浏览 1 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

带刺的爱情 2024-10-30 19:44:59

您的服务器上的 PHP 似乎已配置为在使用 mail() 时与 SMTP 服务器通信。该错误消息表明您的 SMTP 服务器希望您执行直接身份验证,或者执行 POP-before-SMTP 身份验证。如果您使用共享托管,我赞扬您的网络托管提供商如此聪明。

正如评论中提到的 SwiftMailer 是一个功能强大、易于使用的邮件库,其中包括 执行 SMTP 身份验证的能力。有些人还推荐 PHPMailerPEAR 的 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.

不忘初心 2024-10-30 19:44:59

这个问题可以解决,只需在你的 php 中添加以下行:

    ini_set(sendmail_from,'[email protected]');

因此你的代码将变成:

    $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"];

    ini_set(sendmail_from,'[email protected]');
    mail($to,$subject,$body,$header);

This problem can be solved, by simply adding the follwing line in your php:

    ini_set(sendmail_from,'[email protected]');

Thus your code will become:

    $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"];

    ini_set(sendmail_from,'[email protected]');
    mail($to,$subject,$body,$header);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文