Sending Mail in Xampp

I have literally spent hours trying to set up mail on my localhost so that I can send test emails from Magento, and finally its working. So I thought I would share my solution in case it saves others wasted hours too 🙂

Firstly I needed to download the most recent release of sendmail. This can be found here: Once downloaded browse to c:/xampp/sendmail (assuming your installation is on your c:/ drive) and delete and replace with the newly downloaded files.

Then in c:/xampp/sendmail/sendmail.ini comment everything out but the following lines and modify to be your own email address and password.

Then in c:/xampp/php/php.ini search for “mail” and comment out everything but sendmail_path and mail.add_x_header lines.

; For Win32 only.
;SMTP = localhost
;smtp_port = 25
; For Win32 only.
;sendmail_from = postmaster@localhost
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
; 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 =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"

Then restart Apache and it should work!!
To test you can place this script in your htdocs change the $to field and browse to it.

$to = "";
$subject = "Test Email";
$message = "Testing mail is working";
echo "sent";
echo "failed";

Thank you to for pointing me in the right direction 🙂