【发布时间】:2008-09-02 06:15:57
【问题描述】:
我遇到了这个问题:
PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for chris.mahan@gmail.com in c:\inetpub\wwwroot\mailtest.php on line 12
来自这个脚本:
<?php
$to = "chris.mahan@gmail.com";
$subject = "test";
$body = "this is a test";
if (mail($to, $subject, $body)){
echo "mail sent";
}
else {
echo "problem";
}
?>
来自服务器上 php.ini 的部分:
[mail function]
; For Win32 only.
SMTP = server.domain.com; for Win32 only
smtp_port = 25
; For Win32 only.
sendmail_from = support@domain.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
(注意“服务器”和“域”准确指实际的服务器和域名)
在 IIS 中,SMTP 正在运行。在"Access" 选项卡下,"Relay" 按钮下,选择哪些计算机可以通过此虚拟服务器进行中继设置为checkbox "only the list below",列表中为"127.0.0.1(xxx.xxx.xxx.xxx)" (x's representing actual server IP address).
服务器正在运行 Windows Server 2003 Service Pack 2,截至 2008 年 9 月 1 日下午 5 点已完全修补。我假设它正在运行 IIS7(如何检查?)。
有什么想法吗?
回复Espo:这台机器托管在数据中心。我们不想使用 gmail 帐户(正在这样做,想摆脱它)。 Windows server 2003 自带 SMTP 服务器。
更新:根据 Yaakov Ellis 的建议,我放弃了所有中继限制并将服务器 IP 添加到允许列表(使用提供的反向 DNS 按钮),然后事情开始工作了。
感谢 Espo 和 Yaakov 帮助我。
【问题讨论】: