Send emails from XAMPP localhost using Gmail’s SMTP via PHP

Send emails from XAMPP localhost using Gmail’s SMTP via PHP
How is everyone? Hope you are well.
In today’s topic, I will show you how to send emails from localhost via PHP using Gmail’s SMTP (Simple Mail Transfer Protocol). XAMPP Now send email from localhost using Gmail’s SMTP via PHP
Requirements:
Many of us use XAMPP as localhost to learn PHP. So if we want to create a website through localhost.
Where users will provide their email address when they forget their password.
Then the link to reset a password will automatically go to his email address or a verified link will go automatically after registration.
To do this you must turn on SMTP on our localhost. Moreover, you can create a Bulk Email Sender / Email Bomber by writing a few line codes.
So let’s get started.
XAMPP is usually installed on the C: drive. So first go to C: Drive. Then open the xampp folder.
Now open the PHP folder.

Then open the php.ini file using any text editor.
Now you have to find the [mail function]. Press Ctrl + F to enter the mail function.
Now take a good look at the screenshot below.
SMTP = smtp.gmail.com
smtp_port = 587 (or give 25, if 587 doesn’t work)
sendmail_from = Enter your Gmail address here
sendmail_path = â\â C: \ xampp \ Sendmail \ sendmail.exe \ â-tâ
Make sure there are no semicolons (;) at the beginning of the lines above.
Now go to the xampp folder again and open the sendmail folder.

Then open the sendmail.ini file using any text editor.
Now take a good look at the screenshot below.
smtp_server = smtp.gmail.com
smtp_port = 587 (or give 25, if 587 doesn’t work)
error_logfile = error.log (no semicolon (;) at the beginning of the line.)
debug_logfile = debug.log (no semicolon (;) at the beginning of the line.)
auth_username = Enter your Gmail address here.
auth_password = Enter your Gmail address password here.
Now you need to turn on the Less secure app access option from your Gmail account.
So first go to this link https://myaccount.google.com/ then


Now it’s your turn to send an email. Of course, you need an internet connection. You can download the script and send an email with the index.php file. Download Script
Proof:

XAMPP Now send email from localhost! using Gmail’s SMTP via PHP
Hope you like today’s topic. If you do not understand any part, you must comment. Or contact me on Facebook. And, encourage tuners by commenting on the post to get something better. Signing Out