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

Oldest comments (0)