Send Email using XAMPP | Send Email from localhost by using WordPress

preview_player
Показать описание
How to send mail from localhost xampp using Gmail? How to send mail from localhost in PHP using XAMPP? We will send email while using WordPress contact form 7 on localhost using XAMPP server. I do a lot of PHP and WordPress based work on localhost and then migrate it to live. If I have to check email, I have to migrate code to live again and again to just check if email is working properly. This is a time waste in web development and software engineering. To avoid it, to increase productivity and save time, our localhost should send emails. To send email from localhost or XAMPP, we will have to configure XAMPP to send emails over SMTP protocol. We have to configure XAMPP to send email via SMTP. We can use Gmail SMTP to send emails via XAMPP. Basically create a separate Gmail account to only use SMTP and to send emails via localhost. Because we will have to use real email address and password for Gmail account in XAMPP settings.

- Go to XAMPP Installation Directory
- Go to php folder

Search for SMTP
Use these settings

smtp_port=587

Change drive letter to where you have installed XAMPP. In my case I have installed XAMPP in E drive in PC. Change email address in above config.

Then
- Go to sendmail folder in XAMPP

Search SMTP
Use following settings

smtp_port=587
auth_password=PASSWORD

Change email address and password in above config.

And that's it
XAMPP should be able to use your your Gmail account to send email from localhost & XAMPP server. When I used it, at first time, it did not work. For security reasons Gmail will reject this configuration.

There is another step involved.

Turn 'ON', 'Less Secure App Access' from Google account settings.
While you are logged into Google or Gmail account,
Go to Google
Click at icon at right top at the page or your profile image icon
Click at 'Manage Your Google Account'
Go to Security page
Turn on, Less secure app access

Now email will be sent successfully from XAMPP or localhost when you will send it via PHP script or WordPress.
If our SMTP configuration is correct
it should send emails
Use above configuration
and next time does not matter the tech stack
if its using XAMPP, emails will be sent from localhost

And if email is not being sent
Go to sendmail folder in XAMPP
check for text files having name starting with crash
These files will give you a clue about why email is not being sent

In my case error was
Usename and Password not accepted

If you are new to the channel, subscribe to learn more about web development, web application development, editing wordpress source code, how to create a website using wordpress, developing landing page in wordpress, working with child theme wordpress, custom wordpress theme development, wordpress plugin development, how to build a website with wordpress, create website with wordpress and related web development areas.

What if you don't want to use SMTP from gmail?
- Send Email From localhost | localhost SMTP Settings [Updated]

Thank You!
👍 LIKE VIDEO
👊 SUBSCRIBE
🔔 PRESS BELL ICON
✍️ COMMENT

#smtpGmail #smtpWordPress #xamppEmail #localhostEmail #localhost #xampp #xamppServer #php #xamppSettings #SMTP #WebStylePress
Рекомендации по теме
Комментарии
Автор

Great tutorial and well explained, finaly it works. Thank you very much sir.

Fireskull
Автор

I looked everywhere to try and find a comprehensive set of instructions to set up email from localhost using XAMPP -This was just BRILLIANT - 1, 000, 000 Thanks

ozwazme
Автор

I've a problem, can you help me?

habibrayan
Автор

The "Less Secure App Access" setting is no longer available

bellpep
Автор

hi, does this configuration still working? I tried but it didn't work to my localhost site

adminkatwal