Select Page

Sandmail is included with XAMPP to allow PHP scripts to send emails.

It is not tricky to set up, other than the SMTP server you want to send through must allow mail to be sent through them.

We will be using the Gmail SMTP server, but by default, Gmail will not allow you to send though it unless you allow “Less secure app access.” See the screenshot below.

google less secure app access

Once this is enabled in your Gmail account, it’s only a matter of adding some entries in your php.ini and sendmail.ini files.

First, open your php.ini file and you will find entries that are commented out or have default values located under the section [mail function].

You should enter these settings in your php.ini files and insure you are not duplicating them.

[mail function]

; This should be your Gmail address 

; This should be your path to sendmail.exe
sendmail_path="\"C:\xampp\sendmail\sendmail.exe\" -t" 


Now edit your sendmail.ini file located in the \xampp\sendmail\ folder and add the following values, insuring you do not duplicate them.



; Use your Gmail address here
; Use your Gmail password here

That is all there is to it.

Restart Apache so the settings will take affect.

You can check the error.log and debug.log in the \xampp\sendmail\ folder to troubleshoot.

Owner of Elastic Web Works. Computer Science is my specialty and Web Hosting is my work of art.