这是我的代码:
<?php
mail('[email protected] /cdn-cgi/l/email-protection','Test','Test');
?>
发送到非公司地址时,出现以下错误:
Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay in C:\inetpub\wwwroot\internal_tools\include\mail.php on line 2
将电子邮件地址切换到我的工作电子邮件时,效果很好。我的 PHP.ini 看起来也不错:
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
SMTP = PCMAIL1.mycompany.com
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = [email protected] /cdn-cgi/l/email-protection
甚至在 IIS7 中设置站点:
有任何想法吗?
阻止滥用发送垃圾邮件 //en.wikipedia.org/wiki/Open_mail_relay,许多电子邮件服务器要求在中继邮件(将其转发到收件人的电子邮件服务器)之前将客户端验证为合法用户。您已在 IIS 中指定凭据;然而,PHP 并不使用它们。
以下是您的选择:
- 而不是
mail()
函数,使用支持 SMTP 身份验证的现有 PHP 邮件程序库之一(PEAR Mail、phpmailer、Swift Mailer、etc.).
- 安装和配置msmtp http://msmtp.sourceforge.net/或替代方案之一(这里是如何使 msmtp 与 PHP 一起工作 http://www.jacmoe.dk/how-to-send-emails-with-msmtp-on-windows-or-linux-or-mac-os-x)。如果您设置,每当需要发送消息时,PHP 都会执行该程序,该程序确实支持 SMTP 身份验证
sendmail_path
因此。
- 更改邮件服务器的配置以允许从 Web 服务器的 IP 地址中继邮件。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)