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
- open PHP.ini in your code editor
- do a keyword search for “sendmail_path”
- remove the semi-colon in front of it (this uncomments it)
- If you're on windows, use:
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" - Save the file then stop and restart Apache in the XAMPP control panel
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.
- find
smtp_server, uncomment the line and use this:smtp_server=smtp.gmail.com - find
smtp_portuncomment that if need and use:smtp_port=587 - find
auth_username=and add your username to the end of it:auth_username=kittycat91(no need to use the @gmail.com on there) - underneath that should be
auth_passworduse:auth_password=Your$#Bleeping#1$PaSSwOrd - save the file (no need to restart apache this time)
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.
