Configure php mail() on Windows/IIS

Posted by Adam Tuttle on Server Fault See other posts from Server Fault or by Adam Tuttle
Published on 2010-03-17T13:13:54Z Indexed on 2010/03/17 13:21 UTC
Read the original article Hit count: 307

Filed under:
|
|

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?

© Server Fault or respective owner

Related posts about php

Related posts about windows-server-2003