How To Setup Gmail SMTP Plugin In WordPress

How To Setup Gmail SMTP Plugin In WordPress

In this guide, learn how to use Gmail SMTP plugin to solve WordPress sending email issues

If you noticed that your WordPress website is unable to send emails, it could mean there is a problem with the email server in your web host. You can easily resolve this issue by installing Gmail SMTP plugin.

Using a free Google account, you can configure Gmail SMTP to send out emails from your WordPress site. This is usually a straightforward process and should not take more than 30 minutes to complete.


How Gmail SMTP solves your email problem

For several reasons (too many to cover in this guide), WordPress may not be able to send emails using your webhost mail server.

One popular reason is that webhosts restrict the use of PHP Mail function because it is very easy to abuse and has been used extensively by spammers. But since this is the function WordPress uses to send emails, if it is restricted in your server, you will be unable to send emails.

However, when you install Gmail mail SMTP plugin, WordPress would no longer need to send emails through your webhost email server. Instead, emails will be sent using Gmail servers, and this removes the problem.

Also, instead of using the PHP Mail function, which is very easy to abuse, Gmail SMTP uses PHPMailer Library, which is much more secure.

How To Setup Gmail SMTP Plugin

To use this plugin, you would need to have a Gmail account. If this is a free account, note that you can only send out 500 emails per day. This amount is however sufficient for most users.

If you use Google Apps for Work, your daily limit jumps to 2000 emails per day.

Installing The Plugin

To install Gmail mail SMTP, login to your WordPress dashboard.

Place your mouse pointer over Plugins and select Add New.

Add new WordPress plugin

In the search box, type in Gmail SMTP. When it appears in the search result, click Install Now and wait a few moments.

Installing Gmail SMTP Plugin

When the installation completes, the button will change to “Activate”. Click on this button to activate the plugin.

Activate Gmails SMTP Plugin 

After the plugin activates, you will be taken to the plugins page. Scroll to find Gmail SMTP and click Settings.

Gmail SMTP Settings

Authorizing Gmail SMTP to send using your account

Next, you have to authorize Gmail SMTP Plugin to send emails using your Gmail account. To do this, you have to create a web application and generate API keys. Don’t worry, this process is a lot simpler than it sounds.

Creating a new web application

To do this, click the “web application” link.

Create Web Application for Google SMTP

You’ll be taken to Google login page. Login with the account you want to use for sending emails.

In the application registration page, select yes on both items and click Agree and Continue.

Create google application to enable WordPress to send emails via Gmail

Next, click Go to credentials.

Google App Credentials

Leave the API set to “Gmail API”. Select “Web Browser (Javascript)” as the place you would be calling the API from. Under “What data would you be accessing”, select “User data”, and click What Credentials Do I need?

Add Credentials to enable sending WordPress emails via SMTP

In the next page, enter a name in the name input box, and enter your blog URL in the “Authorized JavaScript Origins” input box.

Creating your Client ID

Your “Authorized Redirect URI” is provided in your Gmail SMTP plugin page. Go there and copy it. Ensure you copy the entire link by dragging your mouse across.

Copy redirect URI

Paste this redirect URI in your Gmail credential page, and click Create Client ID.

 Create client ID

In the next step, leave the email address set to the address you want to use, and enter a name for your product. Any name like “WordPress Email” would do.

Next click Continue.

Generate client ID

After clicking continue, your Client ID would be generated. Copy this ID and paste it in the “Client ID” input box in Gmail WP Mail SMTP Plugin page.

Paste client ID - Needed to permit WordPress sending emails via your SMTP account

Next, you need to input your Client Secret.

Generating your Client Secret

To get this, click Done in your Google Credential creation page.

Click Done to access key

You will be taken to your credential management page where you can see the one you just created. Click on the name of the credential.

Select Credential

On the next page, you would see your Client Secret at the top.

Client secret - Needed to permit WordPress sending emails via SMPT

Copy this and paste it in the Client secret input box in Gmail SMTP plugin.

Next, enter the Gmail address you are using in the “OAuth Email Address” and “From Email Address” Input boxes.

Enter your From Name.

In “Type of Encryption”, select TLS, and enter 587 in the “SMTP Port” input box.

Lastly, click Save Changes.

Finish Gmail SMTP setup and save changes

After saving the changes, a “Grant Permission” button will appear at the bottom of the page. Click on it to authorize Gmail SMTP plugin.


In the permission page, click Allow.

Permission to allow WordPress sending emails via gmail

You would be taken back to your plugin page where you should see an “Access Granted” message at the top. Also, SMTP status should now show “Connected”.

Gmail SMTP authorized

Voila! You’re done.

Testing Your SMTP Plugin

After completing the authorization step above, you would need to test to see if WordPress is able to send emails using Gmail SMTP plugin.

To perform this test, switch to the “Test Email” tab.

Test WordPress sending emails via Gmail smtp

Fill out the fields and click Send Email.

 Test Gmail SMTP

After clicking send, Gmail SMTP will display a log showing how the email was sent out, and you should receive the email shortly.

What to do if Gmail SMTP plugin cannot connect to Gmail server

Sometimes, Gmail SMTP server may not send emails, even after correctly authorizing it to use your Gmail account.

You can usually see the source of the error in the log displayed after clicking “Send” on your test email. One common error is the plugin not being able to connect to Gmail servers.

The first time I installed this plugin, here is the error I got.

WordPress sending email via SMTP error - How to fix

On the second line, you can see that the plugin could not connect with Gmail using port 587.

If you get this error, it likely means your web host is blocking that port. Simply contact them and ask them to open port 587, and you would be able to send emails.

As an alternative to consulting your web host, you can change the connection type to SSL and the port to 465. After this change, send another test email to see if it goes.

I hope this article has helped you to understand how to resolve email issues by using Gmail SMTP plugin to send WordPress emails.

If you have any questions or observations, please drop them in the comments section below. And if you need help setting up or troubleshooting Gmail SMTP, you may request our assistance.

More Resources: