本地主机上的 PHP mail() 与 Comcast 的 SMTP 服务器无法正常工作
我正在尝试在计算机上使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然它确实如此,也可能不会这么说:)。要进行身份验证,您需要使用 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.