使用PHP函数发送邮件时中继不允许的消息

发布于 2024-11-09 18:25:45 字数 487 浏览 0 评论 0原文

我正在使用 wamp 服务器并尝试使用 PHP 函数 mail(' 发送电子邮件[电子邮件受保护]','我的主题','我的正文'); ,
php.ini 中进行以下设置:

SMTP = 'ISP's SMTP server'  
smtp_port = 25 

但我收到消息:

Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Relaying not allowed. Please use SMTP Authentication.

如何解决这个问题?

I'm using wamp server and trying to send email with the PHP function mail('[email protected]','my subject','my body'); ,
with the following settings in php.ini:

SMTP = 'ISP's SMTP server'  
smtp_port = 25 

But I get the message:

Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Relaying not allowed. Please use SMTP Authentication.

How can this be solved?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

℉絮湮 2024-11-16 18:25:45

您的 ISP 的邮件服务器不允许“中继”,这是一件好事,否则他们最终会传送大量垃圾邮件。

http://en.wikipedia.org/wiki/Open_mail_relay

开放邮件中继是一种 SMTP 服务器,其配置方式允许 Internet 上的任何人通过它发送电子邮件,而不仅仅是发往或源自已知用户的邮件。这曾经是许多邮件服务器的默认配置;事实上,这就是互联网最初建立的方式,但由于垃圾邮件发送者和蠕虫的利用,开放邮件中继已经变得不受欢迎。许多中继被关闭,或者被其他服务器列入黑名单。

为了能够使用 ISP 的邮件服务器,您需要首先使用用户名和密码进行身份验证。

您可以尝试破解 php.ini 行,如下所示:

SMTP = 'username:password@ISP's SMTP server address'

这不能保证有效,因为此选项需要非标准修改或在邮件服务器上设置的选项。

您的另一个选择是简单地运行您自己的本地代理邮件服务器,无需身份验证,然后将邮件直接发送到收件人的邮件服务器,或通过经过身份验证的连接发送到您的邮件服务器。

我不知道建议与 WampServer 一起使用什么,但与 WampDeveloper Pro 推荐的本地邮件服务器有:

  1. hmailserver
  2. mailenable
  3. Smartermail

您应该看到每一个的功能和要求。我相信其中之一可能会干扰MySQL(因为安装程序会尝试放置它自己的副本)。

Your ISP's mail servers do not allow "relaying", which is a good thing as otherwise they would end up moving a lot of spam.

http://en.wikipedia.org/wiki/Open_mail_relay

An open mail relay is an SMTP server configured in such a way that it allows anyone on the Internet to send e-mail through it, not just mail destined to or originating from known users. This used to be the default configuration in many mail servers; indeed, it was the way the Internet was initially set up, but open mail relays have become unpopular due to their exploitation by spammers and worms. Many relays were closed, or were placed on blacklists by other servers.

To be able to utilize your ISP's mail servers you need to authenticate first with a username and password.

You can try a hack of that php.ini line that goes like this:

SMTP = 'username:password@ISP's SMTP server address'

This is not guaranteed to work as this option requires a non-standard modification or option to be set on the mail server.

Your other option is to simply run your own local proxy mail server that requires no authentication, which will then either send the mail directly to the recipient's mail server, or via an authenticated connection to your mail server.

I don't know what is recommended to be used with WampServer, but with WampDeveloper Pro the recommended local mail servers are:

  1. hmailserver
  2. mailenable
  3. Smartermail

You should see the features and requirements of each one. I believe one of them can interfere with MySQL (as the installer will try to place its own copy of it).

莫多说 2024-11-16 18:25:45

ISPdomain.com SMTP 服务器可能会抱怨您的连接对于其反垃圾邮件规则而言过于基本。

The ISPdomain.com SMTP server is probably complaining that your connection is too basic for its anti-spam rules.

离笑几人歌 2024-11-16 18:25:45

正如错误消息所示,您需要对该服务器使用 SMTP 身份验证。

使用 PHP 的内置 SMTP 功能无法实现这一点。

最简单的方法是使用预制的邮件程序类,例如 Swiftmailer这里是一个如何执行此操作的示例。

As the error message says, you need to use SMTP authentication for that server.

This is not possible using PHP's built-in SMTP capabilities.

The easiest way is to use a pre-made mailer class like Swiftmailer. Here is an example how to do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文