Configure php mail() on Windows/IIS
- by Adam Tuttle
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 = [email protected]
; 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?