Php – Configure php mail() on Windows/IIS

iisPHPwindows-server-2003

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 = me@example.com

; 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?

Best Answer

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