DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

Surjith S M
Surjith S M

Posted on

3 Reasons why Gmail SMTP is not working with PHPMailer()

If you are using Gmail as an SMTP Server, most chances are it won't work on the first try. And it would definitely won't work if you have enabled 2-factor authentication.

So here are the 3 steps you would need to complete before be able to send emails using Gmail SMTP Server.

1. Enable IMAP

This is simple, Just go to Gmail Settings and click the Enable IMAP option.

Step 1

2. Allow Less Secure Apps

Now, go to the following link to Allow Less Secure Apps to Access your Gmail Account. https://myaccount.google.com/lesssecureapps

3. Unlock Other Apps

If you are using 2-Step Verification, the above step won't work. Instead you would need to visit the following link and Unlock Other Apps: https://accounts.google.com/DisplayUnlockCaptcha

Step 2

Hooraay!! SMTP Form should work fine now.

Still not working? Comment below or ask the Gmail Community

Top comments (0)

๐Ÿ‘‹ Hey, my name is Noah and Iโ€™m the one who set up this ad. My job is to get you to join DEV, so if you fancy doing me a favor, Iโ€™d love for you to create an account.

If you found DEV from searching around, here are a couple of our most popular articles on DEV: