简体   繁体   English

PHP邮件不会从Windows Server 2008发送

[英]PHP mail will not send from Windows Server 2008

I have two servers. 我有两台服务器。 One (linux) will send mail fine using the script below. One(linux)将使用下面的脚本发送邮件。 The second (windows server 2008) sends nothing. 第二个(Windows Server 2008)什么都不发送。

<?php mail ( "nobody@email.com", "Contact Us Form", "This is an email from your site", "From: nobody@email.com" )
?>

mail() works very different on linux and windows. mail()在linux和windows上的工作方式非常不同。

  • On Linux it pipes your mail to the sendmail binary, which does all the work 在Linux上,它将您的邮件管道传输到sendmail二进制文件,后者执行所有工作
  • On windows it actually needs to act as an MTA to pass the mail off to another application. 在Windows上,它实际上需要充当MTA以将邮件传递给另一个应用程序。

On windows your best bet is to set the SMTP information so PHP can hand off the mail to another server which will take care of final delivery. 在Windows上,您最好的选择是设置SMTP信息,以便PHP可以将邮件移交给另一台服务器,该服务器将负责最终交付。

http://ca2.php.net/manual/en/mail.configuration.php#ini.smtp http://ca2.php.net/manual/en/mail.configuration.php#ini.smtp

That done (and your webserver restarted to allow the change to take affect) if you're still unable to send mail check the logs for both PHP and the specified MTA to see where things are breaking down. 完成(并且您的网络服务器重新启动以允许更改生效)如果您仍然无法发送邮件,请检查PHP和指定MTA的日志,以查看事情发生在哪里。

Check your PHP.ini You can also override these with the ini_set function at the script level (I think). 检查你的PHP.ini你也可以在脚本级别使用ini_set函数覆盖这些(我认为)。

[mail function]
; For Win32 only.
SMTP = xxx.xxx.xxx.xxx
smtp_port = xx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM