PhP邮件无法工作Windows 7 xampp - argosoft邮件服务器

时间:2014-01-09 17:56:48

标签: php windows email xampp

无论我尝试什么,我都无法使用mail()工作。我多年来成功地使用了这个,但由于某些原因我不能让它工作。

我已经从这里的其他问题中尝试了以下内容:

ini_set( 'sendmail_from', "dev@localhost.com" ); // My usual e-mail address
ini_set( 'SMTP', "localhost.com" );  // My usual sender
ini_set( 'smtp_port', 25 );

(正确)php.ini

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = localhost.com
smtp_port = 25

我可以ping localhost,localhost.com(目前用于localdev上的电子邮件验证)和127.0.0.1

我已经尝试过netstat,当服务器运行时,端口25是“LISTENING”。我可以从Live邮件发送/接收邮件 - 但不是PHP :(也没有错误。

mail("dev@localhost.com", "subj", "test message");

我正在运行win7,尝试关闭防火墙,最后在2013年12月左右下载xampp所以php v非常新。我的文件夹在D:\ xampp而不是C - 我没有使用sendmail而是邮件,所以它应该可以在任何目录下工作。我还将sendmail_from设置为有效的电子邮件,但无济于事......

是的,我在每次更改后都重新启动了网络服务器。

我运行argosoft webserver免费,已经使用了几年。如上所述,我可以通过Live邮件发送邮件,而不是从php文件发送邮件。

1 个答案:

答案 0 :(得分:0)

啊:回答:

我只需配置D:\ xampp \ sendmail \ sendmail.ini默认情况下,它包含行

smtp_server=mail.mydomain.com

我不得不将其改为

smtp_server=localhost

此外 - 直接邮件(收件人,主题,邮件)仍然没有工作,因为手动窗口需要一个从标题 - 所以这(从手动)工作:

      $to      = 'dev@localhost.com';
      $subject = 'the subject';
      $message = 'hello';
      $headers = 'From: dev@localhost.com' . "\r\n" .
          'Reply-To: dev@localhost.com' . "\r\n";

      mail($to, $subject, $message, $headers);

Sendmail的回答取自:

stackoverflow.com/questions/13100659/no-mail-received-in-inbox-with-xampp-1-8-0-mercurymail-and-mail

相关问题