Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

PHP 5.3.13 and as noted IIS 7.5. PHP mail() was working fine until I did 3 things (at the same time). (a) added memory to the server taking it from 4gb to 5gb; (b) ran Windows Update and applied all available updates; (c) removed SQL server installation.

Windows 2008 R2 SMTP server still works fine. I know this because I can drop a file in the pickup folder and the mail is delivered.

This PHP test script:

$subject='Test email using PHP'; 
$message='This is a test email message'. "\r\n"; 
$headers='' . "\r\n" 
       . '' . "\r\n" 
       . 'X-Mailer: PHP/' . phpversion(); 

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

creates this entry in the PHP log file:

 mail() on [C:\www\\store\admin\test_php_mail.php:1]: To: -- Headers:  X-Mailer: PHP/5.3.13

PHP's mail.log.

When using PHP now, I never see a file dropping on the IIS pickup folder. And on other thing, when using previouly working features on the site (such as password recovery), there is no entry made in the mail.log. (The mail log has just been setup to help solve this problem.)

How do I fix this? Or at least how do I diagnose the problem? Thanks.

share|improve this question
What does ini_get('SMTP') return? – Mathias R. Jessen Oct 19 '13 at 18:43
@MathiasR.Jessen returns localhost. – Karl Oct 20 '13 at 14:14

Providing some detail of how the mail is configured in PHP would help.

I avoid MSWindows as much as possible on servers - but I was unaware that PHP will create a mail.log file (it's very unusual that PHP would interact with files in such a way at all given it's architecture) and there's nothing in the code you've published which would write such a file. Are you sure this is not created by your MTA?

Have you tried sending an email by entering SMTP commands directly into a telnet session? Using a different email client on the system?

share|improve this answer
Comment in PHP.ini v5.3.x ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. – Karl Oct 20 '13 at 14:07
Yes, I can send email using telnet. I doubt if it's an SMTP issue, otherwise dropping a mail file on the pickup folder would not result in it being sent, right? As to how PHP is configured, these are the only setting I know about for send(): [mail function] ; For Win32 only.; SMTP = localhost ; smtp_port = 25 located in PHP.ini. Are there other settings? – Karl Oct 20 '13 at 14:51

Under the virtual SMTP server's properties - on the "Access" tab, I granted permission for the public IP address of the server to relay email. Stop and then started the SMTP server, and all is well. Note that I had mentioned that email from the PHP application never landed in the pickup folder - it still doesn't. It does go to the queue folder however. (The SMTP server properties can be accessed using the IIS 6.0 Manager.)

share|improve this answer

I doubt it is your problem but, there is also a "sendmail_from" setting that is for Win32 only. Should be directly below your "smtp_port" setting in php.ini.

Perhaps the removal of SQL Server caused the problem. Do you have the SMTP Server feature installed on the IIS box? If not, I think you'll need to either install it, or you'll need to point to a real SMTP Server in php.ini rather than SMTP=localhost.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.