How To Set Up WP-Mail SMTP for Gmail on WordPress in 2024 – A Step-by-Step Guide

hoow to set up wp-mail smtp on wordpress

Are you experiencing email deliverability issues with your WordPress website? WP-Mail SMTP is the solution to ensure your emails reach your recipients’ inboxes reliably.

The Wp-Mail SMTP helps you stay organized by making your email delivery easy and reliable. It fixes your email delivery issues simply by reconfiguring WordPress to properly use an SMTP provider when sending emails.

In this article, we will guide you through the steps required for you to set up WP-Mail SMTP for Gmail on your WordPress site, and help you establish smooth and efficient email communication. Also by the end of this guide, you will get to know everything you need to know about the WP-Mail SMTP. Let’s dive in.

What Is SMTP?

The acronym SMTP stands for Simple Mail Transfer Protocol. It is a standard communication protocol for sending emails from the sender’s email server to the recipient’s email server.

Your email client, whether it’s Gmail, Outlook, or Apple Mail, relies on SMTP to transmit your emails to your email server. This server has to deliver your message to the intended recipient.

The SMTP server is responsible for handling outgoing emails and ensuring they are efficiently delivered to the destination email server over the Internet.

In a case where proper authentication does not exist, emails either go into the SPAM folder or worse don’t get delivered at all.

How does WP-Mail SMTP Work?

The WP-Mail SMTP plugin takes over the email-sending process when you send an email from your WordPress website.

The plugin uses an external SMTP server specified in the settings to prevent delivery issues instead of relying on the default PHP mail function.

Whenever you use your website to send an email (such as through WP forms submissions, contact form submissions, notifications, or password reset emails), WP Mail SMTP will securely send your email data to the external SMTP server that you set up.

After which, the external SMTP server will process the outgoing email and act as the intermediary between your site and the receiver’s email server.

When the recipient’s email receives the incoming email from the external SMTP server, it stores it in the recipient’s mailbox.

If the email was delivered successfully, the recipient’s email server will send an email delivery confirmation to the external SMTP server. The external server in turn notifies your WordPress website about the email delivery success.

How to Set Up WP-Mail SMTP for Gmail on WordPress

In this section, we will walk you through every step required for you to successfully set up a WP-Mail SMTP to work effortlessly with Gmail on your WordPress website. Let’s dive in.

Install and Activate the WP-Mail SMTP Plugin

To start with, you will need to install and activate the WP-Mail SMTP plugin on your site.

The first thing to do is log in to your WordPress admin dashboard.

Navigate to Plugins and Click on Add New.

wordpress admin dashboard

In the search bar, search for WP-Mail SMTP and click on the Install Now button.

wp-mail smtp installlation

After installing it, click on the Activate button to activate it.

wp-mail smtp activation

Access WP-Mail SMTP Settings

Upon activation, a new page will be opened for you. Click on the Go Back to Dashboard link just below the Let’s Get Started button.

wp-mail smtp setup wizard

Configure the WP-Mail SMTP Plugin Settings

The next thing to do after going back to your dashboard is to begin the configuration process.

Stay with us while we walk you through these steps.

From the WP-Mail SMTP plugin settings page, locate General settings.

wp-mail smtp general settings

From Email

As you scroll down under the general settings, you will see the From Email portion of the page.

Here you will be required to insert the email address from which all your messages will be sent.

Go ahead and input your Gmail address in the address bar.

from email

Checking the box beside the Force From Email option ensures that all the emails being sent from your site come only from the email account that you selected.

Note: Do not check the Force From Email option if you have other email addresses attributed to your site from which you want your emails to be delivered.

From Name

Just below the From Email option is the From Name option.

This is the name that is associated with the emails your website sends out and by default it carries the name of your site.

However, you can change the name to anything you like.

from name

Once you’ve entered the name you want, check the Force From Name option as you can see in the image above. Doing this ensures that this setting is applied site-wide.

This means that any email sent from your site will carry that particular name as its identity.

The Return Path

The next step in the setup is The Return Path option.

We recommend that you check the Set the return path to match the From Email option. This is because checking the Set the return path to match the From Email option ensures that non-delivery receipts or bounce-back emails are not lost.

the return path


This is where you will choose the Mailer you want to use on your site. So, go ahead and choose Google / Gmail.

mailer - wp-mail smtp

When you choose Google / Gmail as your mailer, you will see a new section just below the Mailer titled Google / Gmail.

In this section, there are 2 fields labelled Client ID and Client Secret.

gmail mailer settings - wp-mail smtp

These fields will lead us to the next phase of this configuration process.

Creating a Web App in Google.

To get the information for the fields above, you will create a web app in Google using your Google account.

This process doesn’t require any coding knowledge, we’ll show you what to do.

Note: For this step, you must leave your WP-SMTP settings page. However, you will be coming back to it after you have successfully created your Web App.

Open a new tab in your browser, log in to your Google account and then open the Google Cloud Console.

Note: Be sure to sign out from all Google accounts, leaving only the one you are using for the SMTP set-up.

If you are using Google Console for the first time, you will see a pop-up asking you to select your country, to accept the Terms of Service and Email Updates. Go ahead and do so. Click on Agree and Continue afterwards.

google cloud console - wp-mail smtp

Creating a Project

The next thing to do is to create a project for your app.

To do this, click on the Create Project tab on the right side of your screen to initiate this process.

creting a project - wp-mail smtp

On the New Project page, enter a Project Name and select an organization for your project.

Note: You can leave the organization set to No Organization if you are using your Gmail account and not your Google Workspace account. This is because Google by default will set the organization to No Organization for accounts that are not Google Workspace associated. If you have a Google Workspace and are using the associated Google account, make sure that the account is enabled to send and receive emails.

Next, click on the Create button.

new project wp-mail smtp

Gmail API Enabling

The next thing to do is to enable the Gmail API for your project.

To do this,

Navigate to the sidebar of your Google Cloud Console, locate the APIs and Services tab and click on Library.

Note: If you don’t find the APIs and Services tab pinned on the Sidebar, scroll down and click on More Products and you will find it.

apis and services library - wp-mail smtp

A new page will be opened for you welcoming you to the Google API Library. Scroll down to Google Workspace and locate the Gmail API. You can find the Google Workspace on the main screen or in the sidebar.

When you do, navigate to Gmail API and click on it.

gmail api - wp-mail smtp

Next, click on the Enable button beside the Try This API button.

gmail api enabling - wp-mail smtp

Creating your Gmail API Credentials

After enabling the Gmail API, the next thing to do is to create your application’s credentials.

To do this, locate the CREATE CREDENTIALS button on the newly opened page and click on it.

creating your gmail api credentials

On the next page, you will be required to answer some questions about the type of credential you want to create.

Under the Select an API dropdown, choose the Gmail API. and under What data will you be accessing? Select the User data and click on Next.

credential type

The next thing to do is to configure the OAuth Consent Screen. So go ahead and fill out the required fields.

  • App name: Enter the name you wish to name your App
  • User support email: Here you will select your email address from the list of emails provided.
  • App logo: You can choose to upload a logo for your app if you have one. This field is optional.

app infromtion - wp-mail smtp

After setting up your App name and User support email, the next thing is to set the Developer contact information.

Enter your email in the email address field and then click on SAVE AND CONTINUE to proceed to the next phase.

developer contact information

Scopes (Optional) – WP-Mail SMTP

This step is optional, so we’ll be skipping it for this tutorial. Scroll down this section and click on the SAVE AND CONTINUE button.

scopes - wp-mail smtp

OAuth Client ID Setup

The next step is to set up the OAuth Client ID.

Under the Application type, select the Web application from the dropdown list. Doing this will open up more fields.

oauth clieneet id - wp-mail smtp

You can choose to leave the name in the Name field the way it is, or you can change it to any name of your choice. For this tutorial, we’ll be leaving it the way it is.

oauth client id setup

Skip the Authorized Javascript origins section and move to the Authorized redirect URIs section.

Click on the +ADD URI button and input the following in the field provided: Click on CREATE afterwards.

authorized redirect uris

Once you click on the CREATE button your Credential ID will be shown to you. You don’t have to copy or download it as you will be able to access it in a later step.

Click on the DONE button instead.

your credentials - wp-mail smtp

Congrats on getting to this stage. The next step is to change your app’s publishing status from Testing to Production.

Changing Your App’s Publishing Status from Testing to Production

It is important to know that Google will by default put your app in internal mode (Testing), which comes with a lot of limitations and won’t function well.

So you will need to change it to External mode (Production) and publish it.

Note: If you are using your Gmail account and not your Google Workspace account, your app will be automatically set to External.

To do this, from your Google Cloud Console sidebar, navigate to the OAuth consent screen under APIs and Services and click on it.

oauth consent screen

Next, click on the PUBLISH APP button to change its status from Testing to Production.

publishing app - wp-mail smtp

Clicking on the PUBLISH APP button will open a pop-up screen for you. Click on the CONFIRM button on the pop-up screen to validate your choice.

changing your app's publishing status fromtesting to production

Once the confirmation is complete, you will see that your app’s publishing status has changed from Testing to In production.

publishing status

The next step is to grant your site Gmail permissions.

Granting Your Site Gmail Permissions

To do this, click on the Credentials tab on the sidebar.

credentials - wp-mail smtp

Once you are on the credential page, you can see the details of the app you created under OAuth 2.0 Client IDs.

To retrieve your Client ID and Client Secret click on the pencil icon

oauth 2.0 clieent ids

Doing this will open up all the details for your app. Your Client ID and Client Secret are on your screen’s right side.

Client id and client secret - wp-mail smtp

Go ahead and copy them into their respective fields in your WP-Mail SMTP settings.

wp-mail smtp settings

Once you have filled both fields, scroll down and click on the Save Settings button.

savint authorization settings

Once you click on the Save Settings button, the page will refresh.

Next, you will grant permissions to your plugin, before Google allows it to use the Gmail API to send emails.

To do this, scroll down to the bottom of the screen and click on Allow plugin to send emails using your Google account.

granting your site gmail permissions

Clicking on this button will open up a new login screen for Google. Log into the Google account you are setting up SMTP with.

google's log-in screen

Google’s Verification Warning Bypass

This is for free Gmail users only.

Once you log in with the account you are setting up SMTP with, you will see on the new screen a warning info stating that Google has not verified your app.

Go ahead and click on the Advanced link on the screen.

google's verification warning screen

In the expanded option, click on Go to (unsafe). This happened because Google has not yet verified your app.

More importantly, there’s no need for you to verify the app since you created it for your use.

google's verification warning bypass

On the new screen, click on the Continue button to grant Google access to your WP-mail SMTP

granting wp-mail smtp google access

Once you click on the Continue button, you will be redirected back to the WP-mail SMTP settings screen. Click on the Save Settings button to complete your settings.

A message will be delivered to you stating that you have successfully linked your site to a Google API project. Now you can start sending emails through Gmail.

Sending a Test Email

This is the final step in your set-up.

On the WP-Mail SMTP settings page, click on the Email Test link on the menu list.

email test - wp-mail smtp

On the new screen, enter the email address where you want the test email to be sent. Also, you can choose whether you want the email to be in plain text or HTML format.

Note: If you are unsure that you will be sending only plain texts, we recommend leaving the HTML button toggled ON.

Click on the Send Email button afterwards.

sending a test email

Next, you will receive a message stating that you have sent your email successfully.

email delivery success message - wp-mail smtp

Also, check the inbox of the email address you sent the test email to, to ensure that the message was delivered. As shown below.

test email success from wp-mail smtp

READ ALSO: Redirecting Category Page URLs Using Rank Math


Is WP-Mail SMTP free?

WP Mail SMTP has a free and a premium version. The free version can be found in the WordPress plugin repository. It allows users to configure an SMTP server for sending emails and log basic email information.

However, WP Mail SMTP has a premium version available that offers more advanced features and integrations. This includes support for popular email service providers like Gmail, SendGrid, and Mailgun. The premium version has additional functionality and priority support, but it does require payment.

What is the SMTP server URL for Gmail?

The SMTP server URL for Gmail is

Can I send bulk emails using WP-Mail SMTP?

The Wp-Mail SMTP is designed to send transactional emails and not for sending bulk marketing emails. However, if you need to send bulk emails, you may need to consider dedicated email marketing services.

Can I use WP-Mail SMTP for outgoing emails only?

Absolutely! With WP-Mail SMTP, you have the capability to easily configure it to exclusively handle outbound emails.

This not only guarantees a trustworthy and secure email communication channel from your website but also grants you peace of mind knowing that your emails are in safe hands.

Why can’t I connect to my SMTP server?

There are many factors that can contribute to the difficulty of connecting to an SMTP server.

The most common reasons are incorrect server details, authentication issues, firewall or security software interference, ISP restrictions, server downtime, port blocking, SSL/TLS certificate issues, misconfigured WordPress plugins or email clients, and server status issues.

Check your server settings, authentication credentials, and software configurations carefully to resolve the issue. Contact your email provider or server administrator if issues persist.

Does WP-Mail SMTP work with shared hosting?

Definitely! WP-Mail SMTP is designed to work with shared hosting environments. It optimizes email deliverability regardless of your hosting plan.


Setting up WP-Mail SMTP for Gmail on WordPress is an important step to enhance your email communication.

With this plugin, you can overcome common email deliverability challenges and ensure that your messages reach the intended recipients. By following our comprehensive guide, you’ll experience reliable and secure email communication with ease.

Now, take the first step to improve your email deliverability by installing and configuring WP-Mail SMTP. Enjoy seamless communication and engage your audience effectively!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
Verified by MonsterInsights