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 through it unless you allow “Less secure app access.” See the screenshot below.
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] SMTP=smtp.gmail.com smtp_port=587 ; This should be your Gmail address email@example.com ; This should be your path to sendmail.exe sendmail_path="\"C:\xampp\sendmail\sendmail.exe\" -t" mail.add_x_header=Off
Now edit your sendmail.ini file located in the \xampp\sendmail\ folder and add the following values, insuring you do not duplicate them.
[sendmail] smtp_server=smtp.gmail.com smtp_port=587 smtp_ssl=auto error_logfile=error.log debug_logfile=debug.log ; Use your Gmail address here firstname.lastname@example.org ; Use your Gmail password here auth_password=[password] email@example.com hostname=smtp.gmail.com
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.