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.

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:

Step 2

Hooraay!! SMTP Form should work fine now.

Still not working? Comment below or ask the Gmail Community

Top comments (1)

janfilips profile image
Jan Filips

Watch out for this fraudster. For more see the