Wordpress

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.

XAMPP Now send email from localhost using Gmail's SMTP via PHP

Now open the PHP folder.

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

Then open the php.ini file using any text editor.

XAMPP Now send email from localhost using Gmail's SMTP via PHP

Now you have to find the [mail function]. Press Ctrl + F to enter the mail function.

 

XAMPP Now send email from localhost using Gmail's SMTP via PHP

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.

XAMPP Now send email from localhost using Gmail's SMTP via PHP

Now go to the xampp folder again and open the sendmail folder.

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

Then open the sendmail.ini file using any text editor.

XAMPP Now send email from localhost using Gmail's SMTP via PHP

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.

XAMPP Now send email from localhost using Gmail's SMTP via PHP

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

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

XAMPP Now send email from localhost using Gmail's SMTP via PHP

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

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

Send emails from XAMPP localhost using Gmail's SMTP via PHP
Send emails from XAMPP localhost using Gmail’s SMTP via PHP
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

Admin

Hello, I'm Sumon Sorkar. We promote this content regularly. So tell us what kind of content you want to get. We will broadcast that content. Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button