If you’re hosting any PHP scripts that uses the sendmail() function you know that the function will not work when hosted on Windows IIS. The sendmail() function is reserved for webservers running apache. I have found a fairly easy method to enable the mailing features for PHP scripts that uses sendmail.
First, you will need to have the SMTP virtual server installed on your local machine. You’ll need to change the Properties > Access > Relay Restrictions and add the local IP of your server (I didn’t know localhost required permission to relay mail. It took me 2 days to figure that out :p )
You’ll need to download sendmail.zip
Once downloaded, extract and copy the sendmail.exe & sendmail.ini file into a directory.
for example: c:\Inetpub\usr\lib\
Edit the sendmail.ini
for example: smtp_server=localhost, smtp_port=25, and default_domain=yourserver. Default_domain can be any name.
(the other variables don’t need to be edited)
You will then need to edit the php.ini in c:\windows\
; For Unix only. You may supply arguments as well (default: “sendmail -t -i.”)
You’ll will then need to remove the semi-colon to uncomment out the line and add the path to the sendmail.exe
for example: sendmail_path = c:\Inetpub\usr\lib\sendmail.exe -t -i
(be sure to add the -t -i flags otherwise it will not work.)
Lastly, you will need to edit the permissions to the cmd.exe located in the C:\Windows\System32 folder and add the USERS group and add read/execute access. This allows the sendmail.exe to be executed by the server.
That’s it! Your mail feature will now work with your PHP scripts. Enjoy.