How to configure XAMPP to send test emails through gmail

This is pretty cool, so XAMPP on windows can actually send emails. All you need is to have a gmail account and to configure a couple INI files. Contrary to what you might think you don't actually need the Mercury email service running from the XAMPP control panel.

Edit PHP.ini

PHP.ini is in C:\xampp\php\php.ini

Edit the sendmail.ini file

Again the lines mentioned make sure they are uncommented that is without the semicolon ; in front of them. So open the sendmail.ini file located at C:\xampp\sendmail\sendmail.ini. Open in your code editor.

Enabling Gmail to send (security setting)

You are going to get an alert email from google, because gmail has this feature disabled by default. The first time you press send on your new webform on localhost if your form is actually working, you'l get a email in your gmail inbox warning email that says something like: “Review blocked sign-in attempt” In the email you get, the solution to allow it is in there at the bottom.

<box 80% | Are you the one who tried signing in?> Google will continue to block sign-in attempts from the app you're using because it has known security problems or is out of date. You can continue to use this app by allowing access to less secure apps, but this may leave your account vulnerable. </box>

So you'll click that link and then it will take you to a settings page. Enable it, but later you'll probably want to turn this off to further protect your gmail account.