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

I have a Windows Server 2003 / IIS web server running various application servers, and ended up begrudgingly adding PHP into the mix. I know Win/IIS isn't the ideal environment for PHP, but it's what I've got and I need to make it work.

From phpinfo():

Configuration File (php.ini) Path:   C:\WINDOWS
Loaded Configuration File:           C:\php\php.ini 

From C:\php\php.ini:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from =

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

Lastly, I have IIS setup to run an SMTP relay that allows connection and relay, but only from localhost.

But when I try something that uses mail(), I get this error:

The e-mail could not be sent.
Possible reason: your host may have disabled the mail() function...

Any ideas?

share|improve this question
Try sending an email using telnet and post the exchange here. – symcbean Sep 14 '13 at 22:14

Do you have SMTP server configured on localhost ? If no then 2 ways: 1. Use your ISP's SMTP instead localhost 2. Configure your SMTP server on your localhost. There is more options: a) bundled with win2k3 (appwiz.cpl) b) use 3rd party smtp server

share|improve this answer
"Lastly, I have IIS setup to run an SMTP relay that allows connection and relay, but only from localhost." – Adam Tuttle Mar 19 '10 at 12:18
You can configure IIS SMTP server for all outbound mails in easy way. mark my previous answer ;) – eject May 14 '10 at 11:56

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.