How To Setup Gmail SMTP Plugin In WordPress

How To Setup Gmail SMTP Plugin In WordPress

In this guide, learn how to use the 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 the 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 web hosts restrict the use of the 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 the 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, log in to your WordPress dashboard and then go to  Plugins >> Add New. 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 to send Emails 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.

To create your app, go to the Google Cloud Console website and log in with your google account.

On the cloud console dashboard, you need to create a project before you can access the web application tools.

Click on the dropdown next to “Google Cloud Platform” on the navigation menu. A popup will appear showing a list of projects on your account. To create a new project, select New Project.

On the “New Project” page, enter a name for your project (this can be any name). After that, click on the Create button.

Next, you need to enable the “Gmail API” on the new project you just created. For this, go to API & Services >> Library.

On the “API Library” page, locate the “Gmail API” and click on it.

On the next page, click on the Enable button to activate this API on your project.

After that, click on the Create Credentials button to generate your API keys.

Creating API Credentials

Under “Credential Type”, ensure the Gmail API option is selected from the “Select an API” dropdown. After that, choose the “User data” option as the data type you wish to monitor. Once done, click on the Next button to continue.

You will need to set up the OAuth Consent Screen. Under “App Information”, enter a name for the app (this can be any name). Next, enter your email address in the “User support email” and “Developer contact information” boxes respectively.

After that, click on the Save and Continue button.

There is an optional configuration for “Scope”. But we will skip it here because it does not affect the web app we are creating. Scroll down and click on the Save and Continue button.

Creating Google Web Application

To create your web app, select Web application from the “Application Type” dropdown. After that, you can give the application a name. The default name works well as the app will be available to you alone.

Next, scroll to the “Authorized redirect URIs” section and click on the + ADD URI button. After that, go back to the Gmail SMTP plugin setup page and copy the Authorized redirect URI from the text box.

WordPress sending email - redirect URL

Now head back to the google console dashboard and paste the URL in the box. After that, click on the Create button to complete your web app setup.

Authroize WordPress URI to send emails

Your app credentials are now ready. But, we need to complete some configurations before the app can be useful. For now, click Done, and you will be taken to your cloud dashboard.

Client Secret for gmail smtp plugin

Getting Your Web App Credentials

You need to make your app public before you can use the API keys on the Gmail SMTP plugin. For this, go to API & Services >> OAuth consent screen from your cloud console dashboard.

resolve WordPress not sending email issue

On the “Publishing Status” section, click on the Publish App button to make your app available publicly. Also, ensure the User Type is set to “External” if not done by default.

Gmail SMTP publish app

Now, to access the app credentials, click on the Credentials sidebar menu. In the “OAuth 2.0 Client IDs” section, you will see details about the app you just created.

Get credentials

To get the Client ID and Secret, click on the Pencil icon next to the Web application you created. You will see the details you need on the next page. Copy both values as you will need them in the next step.

API credentials for WordPress to send emails

Configuring the Plugin

On the plugin settings page, paste the client ID and client secret values you copied from Google cloud into their respective text boxes.

configurig gmail smtp plugin

After that, enter your “OAuth Email address”. The OAuth email address should be the same as the one you used when creating the web application.

Next, fill in the “From Email Address” and the “From Name” values. This will be the name and email address your WordPress emails will be sent from.

WordPress sending emails using gmail smtp

Leave the Encryption Type set to (TLS) and then enter 587 in the “SMTP port” textbox. Finally, click on the Save Changes button to update your changes.

Now you need to authorize your website to access your google account. For this, click on the Grant Permission button.

Grant permissions so WordPress can send emails

On the google authentication page, you need to choose the google account you used to create the web application.

A Google verification error message may appear if the app is not verified. This is because Google runs security checks on apps.

To bypass this error, click on the Show advance link and then select the “go-to (unsafe)” link.

authorize WordPress to send emails using gmail

On the permissions page, click on Allow to grant your website access to your google account.

Permission to allow WordPress sending emails via gmail

After this, you will be redirected back to the Gmail SMTP page, where you will see that the service has now been connected as seen in the image below.

Gmail SMTP status

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.

Test Email for Gmail SMTP plugin

What to do if the 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 the 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:

 This post was written by Sam Mulaim

Hello! I’m Sam - the founder and CEO of FixRunner WordPress support. When I started FixRunner one of my goals was to help people run a successful website and overcome WordPress issues. I don’t have much time these days to write new posts but when I do I enjoy it very much.

Last edited by: FixRunner Team