本地主机上的 PHP mail() 与 Comcast 的 SMTP 服务器无法正常工作

发布于 2024-12-23 16:52:20 字数 1033 浏览 3 评论 0原文

我正在尝试在计算机上使用 mail() 函数,以便测试我为某人构建的 Web 应用程序的系统电子邮件。在 php.ini 文件中,我将 sendmail_sender 更改为我的电子邮件地址。 php.ini 中的 SMTP 设置如下:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.comcast.net
; http://php.net/smtp-port
smtp_port = 25

当我尝试使用 PHP 发送邮件时,出现以下错误:

警告:mail() [function.mail]:SMTP 服务器响应:550 5.1.0 第 28 行 C:\wamp\www\register.php 中需要身份验证

这是我的 PHP 邮件代码:

$url = "http://localhost/activate.php?key=".$key;
$email_body = "Dear ".$name.",

Thank you for registering on Yamma.org! To activate your account, please click on the following URL: 

".$url."

If the above URL is not clickable, please copy the FULL URL and paste it into your browser's address bar.

Sincerely,
The Yamma Team
http://www.yamma.org";

mail($email, $settings['activate_email_subject'], $email_body, "From: ".$settings['emails_sent_from']);

有谁知道为什么我会收到此错误?我认为 Comcast 的 SMTP 服务器不需要身份验证,是吗?

I'm trying to use the mail() function on my computer so I can test the web application's system emails that I'm building for someone. In the php.ini file I changed sendmail_sender to my email address. The SMTP settings in php.ini are as follows:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.comcast.net
; http://php.net/smtp-port
smtp_port = 25

When I try sending mail with PHP, I get this error:

Warning: mail() [function.mail]: SMTP server response: 550 5.1.0
Authentication required in C:\wamp\www\register.php on line 28

Here is my PHP mail code:

$url = "http://localhost/activate.php?key=".$key;
$email_body = "Dear ".$name.",

Thank you for registering on Yamma.org! To activate your account, please click on the following URL: 

".$url."

If the above URL is not clickable, please copy the FULL URL and paste it into your browser's address bar.

Sincerely,
The Yamma Team
http://www.yamma.org";

mail($email, $settings['activate_email_subject'], $email_body, "From: ".$settings['emails_sent_from']);

Does anyone have any idea of why I could be getting this error? I don't think Comcast's SMTP server needs authentication, or does it?

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

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

发布评论

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

评论(1

半山落雨半山空 2024-12-30 16:52:20

显然它确实如此,也可能不会这么说:)。要进行身份验证,您需要使用 PHPMailer、SwiftMailer 或 Zend_Mail 等库。

Apparently it does or it wouldn't be saying that :). To do authentication, you will need to use a library like PHPMailer, SwiftMailer, or Zend_Mail.

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