Normally, php mail's function doesn't *work* on Windows because there is no sendmail server running by default.

Some people got it working using Fake Sendmail and StunnelĀ  & an external service such as Gmail/Yahoo, and others using msmtp.

I didn't want my gmail or other credentials saved on the computer or a too complicated solution that may be hard to troubleshoot so I decided to use the Mandrill service to send emails from my development machine.

So the steps are the following

  1. Download Fake Sendmail
  2. Extract the archive contents in c:\usr\lib
    Important Note: if you're running Windows 7 or 8 (not sure for Vista) you need to set XP Compatibility Mode. To do that right click on Sendmail.exe and click on properties and then enable XP compatibility mode (shown below).
  3. Edit php.ini (shown below)
  4. Signup for Mandril
  5. Create an API key (which will be your password) by going to Settings
  6. Configure Fake Sendmail (shown below)
  7. Restart Web Server or restart computer if that's easier.

Enable XP Compatibility Mode on Fake Sendmail

Enable XP Compatibility Mode on Fake Sendmail

php.ini configuration (partial)

[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 =
sendmail_path = "c:\usr\lib\sendmail.exe -t"

Fake Sendmail Configuration (Windows)
Make sure you edit the following.

  • default_domain=YOUR_DOMAIN_GOES_HERE

Note: if you're configuring your own copy of the config file make sure you don't use encryption i.e. smtp_ssl=none (as shown in the snippet). I've had no problems using the command line scripts, however, the php script would hang if Fake Sendmail used encryption.