Sending email from localhost

Posted on March 18, 2015 by Suresh Kamrushi in PHP

Now developer can test email functionality before deploying to the production or staging server in his local environment itself. Just we need to change few files in XAMPP to make it working.

You need to change two files for it, i.e. php.ini file which you will find “C:\xampp\php\php.ini” and another is sendmail.ini which can be located at “c:\xampp\sendmail\sendmail.ini”.

let see what you need to change:
1) php.ini (“C:\xampp\php\php.ini”)
open file and look for “mail function” in the file and change below values (here i am using a dummy gmail account, you need to use actual details):
sendmail_from =
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

2) sendmail.ini (“c:\xampp\sendmail\sendmail.ini”)
open the file and update as below:

Before testing mail() function restart apache to make it active.

If you are using gmail you should allow access to less secure app HERE. Gmail complete setting for SMTP is HERE

1) If It does not work try smtp port 587 instead 25.
2) My Current XAMPP version is 1.8.2
3) My PHP version is 5.4.16


Tagged as ,