Articles on: WordPress

Deliver WordPress Emails Using Gmail SMTP with WP Mail SMTP

Note: The plugin only works if you install in or format. Delivery will be unsuccessful and error prompt from Google will appear if your WordPress is installed in subdirectory. Secondly, you need to sign up for 12-months free trial account for Google Cloud Platform before can proceed with the steps below. This will require that you enter credit card information to set up an account, even if using a free Google Cloud Platform account.

After installing and activating WP Mail SMTP, go to Settings » WP Mail SMTP to open the plugin settings page. At the top of this page, you’ll see the From Email and From Name. You can ignore these settings, because Google will automatically force these values to match the email account used in the next step. To start the setup process, you’ll need to scroll to the Mailer field and select the Google option.

You can skip the Return Path checkbox, as Google does not allow this setting to be altered.

It's time to create Web Application inside your Google Cloud Platform account. To create an application, you’ll first need to sign into your Gmail account and access Gmail’s application registration. Clicking that link should open this Google page in a new tab or window, and you’ll want to keep your site settings open (we’ll return to those later).

Once you’ve followed that link and logged into your Gmail account, you should see a form named “ Register your application for Gmail API in Google API Console ”.

In the dropdown labeled Select a project where your application will be registered, leave the default option of Create a project. Then, go ahead and click the Continue button.

Next, you should see a screen that says “ The GMAIL API is enabled ”. To proceed to the setup page, click the Go to credentials button.

In the next page, you just need to select following settings as shown below:

For this step, you’ll be creating an OAuth client ID. OAuth, or Open Authorization, is what will provide permission for your website to use your Gmail account to authenticate emails.

For the Name field, enter anything you like or leave the default name. This is only for reference within your Google account.

For the Authorized JavaScript origins, you’ll need to enter your site’s URL.

NOTE: Only and will work in this example. This method does not work for subdirectory.

Last, we need to fill out the Authorized redirect URIs field. To get the URI for your site, you’ll need to go back to the tab or window with your WordPress site. Still on the Settings » WP Mail SMTP page, you’ll need to look under the Gmail section for the field labeled Authorized redirect URI .

The value in this field should be your site’s URL followed by some extra details. You’ll need to copy this value, which is easily done by clicking the button with the copy icon.

After copying the URI, return to the Google APIs page and paste it into the field under Authorized redirect URIs.

After that, you can click the Create OAuth client ID button.

For the last step in the app creation process, you’ll need to set up the consent screen. This screen will never be seen by your users since you’re only granting permission for your own site to use the Gmail account you own.

You’ll just need to check your email address and then enter a Product name shown to users (such as the title of your website). When you’ve completed these fields, click Continue.

You’ve now successfully created a Gmail web application!

Now we need to see the full details. On the last screen, click I’ll do this later to go to the Credentials page.

On the Credentials page, you can now see the details of the web application you just created. To view Client ID and Client Secret, click the edit icon.

This will open all of the details for your app. On this page, you’ll need to copy the Client ID and Client secret values.

Each of these will need to be copied into your WP Mail SMTP settings back in your WordPress admin.

After saving these settings, the page will refresh. Before Google allows this information to be used to connect to your account, however, you must grant permission.

To do this, scroll to the bottom of this page and click the button labeled Allow plugin to send emails using your Google account.

This will open a login screen for Google. Go ahead and log into the account you’re setting this SMTP up with. Then, you’ll see a screen asking for permission for this site to send email on your behalf.

When you’re ready, click the Allow button to proceed.

Next, you’ll be returned to your WP Mail SMTP settings and a success message will be displayed. Now that the connection is complete, you’re ready to send a test email under the Email Test tab.

Successful email delivery will appear if your settings have been applied correctly. The recipient will receive the following successful email.

Updated on: 14/01/2019

Was this article helpful?

Share your feedback


Thank you!