### [Google Workspace / Gmail](https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/)

**Published:** November 21, 2023
**Author:** David Ozokoye

**Excerpt:** Learn how to set up Gmail or Google Workspace in WP Mail SMTP.

**Content:**

Would you like to use your Gmail or Google Workspace (formerly G Suite) account to fix email delivery issues on your site? WP Mail SMTP’s Google Workspace / Gmail option uses Google’s API to securely authenticate your site’s emails, helping them to arrive successfully in your users’ inboxes.

This tutorial will show you how to set up WP Mail SMTP using the Google Workspace / Gmail mailer with your Gmail or Google Workspace email address.

- [Installing and Configuring the WP Mail SMTP Plugin](#installation)
- [Activating One-Click Setup](#one-click-setup)
- [Creating a Web App in Your Google Account](#create-app)
- [Updating the Publishing Status From Testing to Production](#from-testing-to-production)
- [Granting Your Site Google / Gmail Permissions](#permissions)
- [Sending a Test Email](#test-email)
- [Frequently Asked Questions](#faq)

---

## Installing and Configuring the WP Mail SMTP Plugin

Before getting started, you’ll need to [install and activate the WP Mail SMTP plugin](https://wpmailsmtp.com/docs/how-to-install-the-wp-mail-smtp-plugin/).

Once you’ve [verified your license](https://wpmailsmtp.com/docs/how-to-verify-your-wp-mail-smtp-license/), you’re ready to configure the plugin’s settings. You can find them by going to **WP Mail SMTP » Settings** and looking under the **General** tab.

![General tab SMTP settings](https://wpmailsmtp.com/wp-content/uploads/2023/08/wp-mail-smtp-settings.png)Below, we’ll cover the settings needed for this setup.

### From Email

This is the email address that all of your site’s emails will be sent from. You can type your email address into the field provided, including any [aliases you’ve configured](https://wpmailsmtp.com/gmail-send-from-alias-wp-mail-smtp/), after you connect your site to the Gmail API in later steps.

![From Email Gmail mailer](https://wpmailsmtp.com/wp-content/uploads/2023/11/from-email-gmail-mailer-2.png)The **Force From Email** option will make it so that all the emails sent from your site come from the address you’ve entered.

**Note:** In order to use multiple Gmail aliases throughout your WordPress site as the From Email address, make sure to leave the **Force From Email** box unchecked.

### From Name

Below the From Email, you can set the **From Name**. This is the name associated with the emails your site sends out. By default, it will be set to your site’s name, but you can adjust it to anything you’d like.

You can also check the **Force From Name** option to apply this setting site-wide.

![From Name in WP Mail SMTP settings](https://wpmailsmtp.com/wp-content/uploads/2021/10/from-name.png)### Mailer

This is where you can choose which mailer you’d like your site to use. Select the **Google / Gmail** option.

![Select Gmail mailer](https://wpmailsmtp.com/wp-content/uploads/2025/12/google-mailer.png)Once you’ve chosen this mailer, you should see a new section appear titled **Google / Gmail** with more authorization options.

![The Google / Gmail mailer settings](https://wpmailsmtp.com/wp-content/uploads/2023/11/google-gmail-mailer-settings.png)There are two ways to configure the Google Workspace / Gmail mailer: Using the One-Click Setup or manually creating a custom Google app to generate your **Client ID** and **Client Secret**.

If you’re deciding between One-Click Setup and manual setup, here’s a quick comparison:

Manual SetupOne-Click Setup (Pro)**Ease of Use**Step-by-step guide to assist youInstant connection with minimal steps**Technical Steps**Requires creating a Google app and configuring credentialsNo manual configuration needed**Time Required**Approximately 30-60 minutesLess than 2 minutes**Support**Access to extensive documentationPriority support from our team**Ideal For**Users who prefer detailed setup and learning processUsers seeking the fastest and easiest setupLooking for the quickest way to get started? [One-Click Setup](#one-click-setup) simplifies the process so you can start sending emails right away.

[👉 Upgrade to Pro & Enable One-Click Setup](https://wpmailsmtp.com/pricing/)

However, if you prefer to set things up manually, jump to the [creating a web app](#create-app) section of this guide to continue.

## Activating One-Click Setup

For an easier and quicker email setup, we recommend using the One-Click Setup feature. It allows you to connect your site to Gmail / Google Workspace with just a few clicks.

The One-Click Setup feature requires a [Pro license or higher](https://wpmailsmtp.com/pricing/).

After selecting Google / Gmail as your mailer in the WP Mail SMTP settings, you will find the option to activate the **One-Click Setup**. Simply switch this toggle to the **ON** position to begin the simplified setup process.

![](https://wpmailsmtp.com/wp-content/uploads/2023/12/one-click-setup-gmail-mailer.png)For more detailed information on the One-Click Setup process, be sure to check out our guide on [Google Workspace / Gmail Mailer One-Click Setup](https://wpmailsmtp.com/docs/google-workspace-gmail-mailer-one-click-setup).

## Creating a Web App in Your Google Account

You’ll be coming back to WP Mail SMTP’s settings page a little later, so for this step, open a new tab or window in your browser.

In the new tab or window you’ve opened, log in to your Google account and open your [Google Cloud Console](https://console.cloud.google.com/home/dashboard).

**Note:** Before continuing, be sure to sign out of all other Google accounts besides the account you’ll be using for the SMTP setup.

Also, if you’re using Google Workspace, make sure that the Google account you use has permission to send emails (in other words, access to its own inbox).

If it’s your first time using Google Cloud Console, you may see a pop-up asking you to select your country and agree to the Terms of Service. Go ahead and do so, then click on **AGREE AND CONTINUE** to move on to the next step.

![Accepting the Google Cloud terms of service](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-terms-service.png)If you’ve logged in to the Google Cloud Console before, you’ll likely bypass the Terms of Service.

### Creating or Choosing a Project

First, you’ll need to choose a project to use for your app. You can select an existing one or create a new one.

To do so, click on the projects dropdown in the toolbar at the top of your dashboard.

![Opening the Google Cloud projects dropdown](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-projects-dropdown.png)In the popup that appears, select an existing project from the list or click on **New Project** in the top right corner.

![Choosing to set up a new project for an app in Google Cloud](https://wpmailsmtp.com/wp-content/uploads/2022/11/create-new-project.png "Choosing to set up a new project for an app in Google Cloud")If you selected an existing project, move on to the next step. For a new project, enter a project name and select an organization and location from the dropdowns.

![Creating a new project in Google Cloud](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-create-new-project.png)Then click on the **CREATE** button.

### Enabling the Gmail API

Next, you need to enable the Gmail API for your project. In your Google Cloud Console sidebar, go to **APIs & Services » Library**.

![api services library](https://wpmailsmtp.com/wp-content/uploads/2022/11/api-services-library.png)**Note:** If you don’t see **APIs & Services** in the sidebar, it may be found by scrolling down and clicking on **MORE PRODUCTS**.

Then look under **Category** and click on **Google Workspace**, or enter “Gmail API” in the search bar.

![Opening the Workspace category in the Google API Library](https://wpmailsmtp.com/wp-content/uploads/2022/11/gmail-api.png "Opening the Workspace category in the Google API Library")Click on the **Gmail API** result.

![The Gmail API](https://wpmailsmtp.com/wp-content/uploads/2022/11/select-gmail-api.png "The Gmail API")On the Gmail API page, click on the blue **ENABLE** button.

![Enabling the Gmail API](https://wpmailsmtp.com/wp-content/uploads/2022/11/enable-gmail-api.png "Enabling the Gmail API")### Creating Your Application’s Credentials

After you enable the Gmail API, you should be redirected to the Gmail API Overview page. Here, click the **Create credentials** button.

![Creating credentials for the Gmail API](https://wpmailsmtp.com/wp-content/uploads/2025/12/create-credentials.png "Creating credentials for the Gmail API")On the next page, Google will ask a few questions to determine the Credential Type you need. From the **Select an API** dropdown, choose **Gmail API**.

![Select Gmail API](https://wpmailsmtp.com/wp-content/uploads/2021/10/select-gmail-api.png)**Note:** If you don’t see an option for the Gmail API in the dropdown, be sure that you have the [Gmail API enabled](https://support.google.com/googleapi/answer/6158841?hl=en) for your account.

Next, under **What data will you be accessing?**, select the **User data** option. Then click the **NEXT** button to proceed.

![Click-next-button](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-next-button.png)### Configuring Your OAuth Consent Screen

Google will then ask for some basic information about your app.

This section is mostly for personal use since no one else will be using your app. However, some fields are still marked as required:

- **App name:** Enter an app name of your choice (e.g., Pattie’s App).
- **User support email:** Select your email address from the choices provided.
- **App logo:** If you’d like, you can upload a logo for your app. This is optional.

![Entering app information in Google Cloud](https://wpmailsmtp.com/wp-content/uploads/2021/10/app-information.png)Finally, add your email address in the **Email addresses** field. Then click on the **SAVE AND CONTINUE** button to proceed to the next step.

![Click save and continue button](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-save-and-continue-button.png)### Configuring Scopes (Optional)

This is an optional step that we’ll be skipping for this tutorial. Scroll down to the end of the **Scopes** section and click on the **SAVE AND CONTINUE** button to proceed.

![Continuing past the Google Cloud scopes setup](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-save-and-continue-button-scopes-section.png)**Note:** For more information on Gmail API scopes, please see Google’s [developer documentation](https://developers.google.com/gmail/api/auth/scopes).

### Setting Up Your OAuth Client ID

Next, you’ll need to fill out some information about your OAuth Client ID.

From the **Application type** dropdown, select the **Web application** option. Once you do so, more fields will automatically populate.

![Select web application](https://wpmailsmtp.com/wp-content/uploads/2021/10/select-web-application.png)You can leave the **Name** field as the default value or change it to something more relevant. For this example, we’ll keep the default name, **Web client 1**.

![OAuth name](https://wpmailsmtp.com/wp-content/uploads/2021/10/OAuth-name.png)Next, skip the **Authorized JavaScript origins** section and scroll to **Authorized redirect URIs**.

Click on the **+ ADD URI** button and input the following: `https://connect.wpmailsmtp.com/google/`. You can also copy this value from your WP Mail SMTP settings and paste it here if you prefer.

![Input for URI](https://wpmailsmtp.com/wp-content/uploads/2021/10/input-for-uri.png)Then click the **Create** button to complete this step.

![Click create button](https://wpmailsmtp.com/wp-content/uploads/2025/12/click-create.png)Once your app has been created, the **Your Credentials** section will expand to show you your Client ID. There’s no need to copy it now, as you’ll access it from another area in a later step.

Instead, go ahead and click the **DONE** button at the bottom of the page.

![Click done button](https://wpmailsmtp.com/wp-content/uploads/2025/12/click-done.png)## Updating the Publishing Status From Testing to Production

Google will put your app into Internal mode by default. It’s really important that you switch it to External mode and publish it. Otherwise, your app will be super limited and won’t function properly.

In your Google Cloud Console sidebar, go to **APIs & Services » OAuth consent screen**.

![Select OAuth consent screen option](https://wpmailsmtp.com/wp-content/uploads/2025/03/oauth-concent.png)Then select the **Audience** tab.

![Select Audiences tab](https://wpmailsmtp.com/wp-content/uploads/2025/03/audience-tab.png)The exact screen you’ll see next will vary depending on whether you’re using a free Gmail account or a Google Workspace account.

### Google Workspace Users

Under **User type**, click on the **MAKE EXTERNAL** button.

![Clicking the MAKE EXTERNAL button to change the publishing status of a Google Cloud app](https://wpmailsmtp.com/wp-content/uploads/2025/03/make-external.png)**Note:** Only users within your organization can access your app if the **User type** is set to **Internal**. For example, if your Workspace domain is **example.com**, users can only access your app using an **@example.com** email address.

External email addresses will see an error that reads `Error 403: org_internal` when granting WP Mail SMTP access to your app.

In the pop-up window that appears, select the **In production** option. Then click on **Confirm**.

![Setting the Google Cloud app publishing status to In production](https://wpmailsmtp.com/wp-content/uploads/2025/12/confirm-publish.png)### Gmail Users

If you’re not using Google Workspace, you won’t see the MAKE EXTERNAL option. Instead, you’ll need to publish your Google app.

Under **Publishing status**, you’ll see the app status is set to **Testing**. Go ahead and click the **PUBLISH APP** button to update your app status.

![Publish app](https://wpmailsmtp.com/wp-content/uploads/2025/03/publish-app.png "Click the Publish App Button")In the overlay that appears, click **CONFIRM** to publish your app.

![Confirm app publishing](https://wpmailsmtp.com/wp-content/uploads/2020/11/confirm-app-publishing.png "Confirm App Publishing")Once confirmation is complete, you’ll see that your app’s Publishing status is now **In production**.

![Checking the publishing status of a Google Cloud app](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-app-publishing-status.png)## Granting Your Site Google / Gmail Permissions

Next, navigate to **APIs & Services » Credentials** in the left side menu.

![api credentials page](https://wpmailsmtp.com/wp-content/uploads/2022/11/api-credentials.png)Once there, look under the **OAuth 2.0 Client IDs** section. You’ll see the details of the web application you just created. To view the **Client ID** and **Client Secret**, click the pencil icon.

![Click pencil icon](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-pencil-icon.png)This will open all of the details for your app. On the right side of this page, you’ll see the **Client ID**.

![Client ID and client secret](https://wpmailsmtp.com/wp-content/uploads/2025/12/copy-client-id.png)Scroll down to the Client secrets section. Then click the + Add secret button.

![Create new client secret](https://wpmailsmtp.com/wp-content/uploads/2025/12/add-secret.png)You’ll see the new Client secret below the default one. Click the copy icon to copy its value.

![Copy client secret](https://wpmailsmtp.com/wp-content/uploads/2025/12/copy-client-secret.png)Go ahead and copy both of these values into the corresponding fields in your WP Mail SMTP settings.

![Pasting your Client ID and Client Secret in the Google / Gmail mailer settings](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-gmail-add-client-id-secret.png)**Note:** Be very careful not to copy any extra text or spaces with your Client ID or Client Secret, as this will result in an error in the next step.

Once you’ve added these values, click the **Save Settings** button at the bottom of the page.

![Save settings button](https://wpmailsmtp.com/wp-content/uploads/2022/12/save-changes-google-mailer.png)After saving your settings, the page will refresh. You must grant permission before Google allows our plugin to use your Gmail API to send emails.

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

![Authorize plugin to send emails with Gmail](https://wpmailsmtp.com/wp-content/uploads/2022/12/allow-google-to-send-emails.png)This will open a login screen for Google. Go ahead and log in to the account you’re setting up SMTP with.

Next, you’ll see a screen asking for permission for this site to send emails on your behalf.

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

![Allowing your site to send emails from your Google account](https://wpmailsmtp.com/wp-content/uploads/2020/11/allow-google-permissions.png)### Bypassing Google’s Verification Warning (Free Gmail Users Only)

You might see the following screen if you are connecting with a free Gmail account. Go ahead and click on the **Advanced** link in the bottom left corner.

![Gmail OAuth warning](https://wpmailsmtp.com/wp-content/uploads/2021/10/gmail-oauth-warning.png)In the expanded section, click on **Go to wpmailsmtp.com (unsafe)**. Don’t worry, Google only displays this warning because it hasn’t verified your app. There is no need to verify it since you created this app just for your own use.

![Gmail OAuth show advanced](https://wpmailsmtp.com/wp-content/uploads/2021/10/gmail-oauth-show-advance.png)Then click on the **Allow** button as shown above.

### Backup Connection

Setting up a [Backup Connection](https://wpmailsmtp.com/docs/configuring-backup-connection/) is optional and isn’t required to complete your Google Workspace / Gmail mailer setup. However, to further improve email deliverability, we recommend [configuring an additional connection](https://wpmailsmtp.com/docs/configuring-additional-connections/) to serve as a backup in case your Primary Connection fails.

![backup-connection-settings](https://wpmailsmtp.com/wp-content/uploads/2022/12/backup-connection-settings.png)**Note:** Want to route your emails through a specific additional connection based on a set of rules or conditions? Be sure to check out our tutorial on [Smart Routing](https://wpmailsmtp.com/docs/setting-up-smart-email-routing/) to learn how.

## Sending a Test Email

Next, you’ll be returned to your WP Mail SMTP settings, and a success message will be displayed. Once the connection is complete, you’re ready to send a test email. To do so, navigate to **WP Mail SMTP » Tools** and open up the **Email Test** tab.

![Email Test tab in WP Mail SMTP](https://wpmailsmtp.com/wp-content/uploads/2021/08/Email-test-tab-in-WP-Mail-SMTP.png)Once the **Email Test** tab is open, you’ll need to enter an email address whose inbox you have access to.

**Note:** If you’ve set up an [additional connection](https://wpmailsmtp.com/docs/configuring-additional-connections/), you’d be able to choose between your Primary Connection and other connections when sending a test email.

Next, choose whether to send a plain text or HTML email. Unless you know you’ll only be sending plain text emails, we recommend leaving the HTML setting toggled **ON**. Then click the **Send Email** button.

![Click send email button](https://wpmailsmtp.com/wp-content/uploads/2021/08/Click-send-email-button.png)You’ll see a success message when the test email has been sent.

![WP Mail SMTP test email success message](https://wpmailsmtp.com/wp-content/uploads/2021/08/WP-Mail-SMTP-test-email-success-message.png)You should also soon receive the test email at the email address you entered.

![Successful test email from WP Mail SMTP](https://wpmailsmtp.com/wp-content/uploads/2021/08/Successful-test-email-from-WP-Mail-SMTP.png)## Frequently Asked Questions

These are some of the top questions we receive about setting up the Google Workspace / Gmail mailer.

#### What if the test email doesn’t send successfully?

If the SMTP test email isn’t able to send, a debug log will appear with additional details. Here are some of the possible error messages and how to resolve them.

`401. That’s an error.Error: invalid_client`

This error appears when the Client ID isn’t able to be read properly. To fix it, try copying and pasting your Client ID again and check that there’s no whitespace or extra text.

`400. That’s an error.Error: invalid_requestMissing required parameter: client_id`

This error will display when the Client ID field is empty or not able to be read properly. To fix it, try copying and pasting your Client ID again and check that there’s no whitespace or extra text.

`cURL error 60: SSL certificate problem`

This message means that the server is missing a certificate that’s required for SMTP to work. To fix this, you’ll need to contact your site’s hosting provider to ask them to install this certificate (most likely the cacert.pem certificate, though it’s best to ask your host to check).

`“code”: 401,“message”: “Login Required”`

If you see this in the debug message, you still need to grant permission for WP Mail SMTP to access your Google account. For instructions on how to fix this, please see [Step 4](#permissions) of this tutorial. Also, be sure to check that the From Email in your SMTP settings matches the email used to set up your Google app.

`Request Entity Too LargeError 413`

If you’re seeing this error, it’s likely that files being sent through your forms exceed Gmail’s limit for direct file attachments in emails. This limit is applied to the sum of the message’s text as well as the encoded attachment. To prevent this error, you’ll need to make sure that all files are no larger than 22 MB.

`There was a problem while retrieving Auth for gmail: Could not json decode the token`

This error is a possible indicator that another plugin (such as UpdraftPlus) is loading a different version of Google’s API on the site, creating a conflict. If possible, the conflicting plugin should be deactivated. Otherwise, it’s recommended that you [set up a different mailer](https://wpmailsmtp.com/docs/a-complete-guide-to-wp-mail-smtp-mailers/).

If none of the above apply, or the test email still isn’t working, your Google account may have the Gmail API disabled. To check on this, follow [Google’s guide to enabling an API](https://support.google.com/googleapi/answer/6158841?hl=en).

#### What if I see a screen that says, “This app isn’t verified”?

When you click the **Allow plugin to send emails using your Google account** button in your WP Mail SMTP settings, Google might display a screen that says, “This app isn’t verified. This app hasn’t been verified by Google yet. Only proceed if you know and trust the developer.”

There’s no need to worry, though. This message is only referring to the app that you created in your own Google account, so you are actually the developer in this case.

To bypass this message, click **Advanced** and then click **Go to wpmailsmtp.com (unsafe)**.

![Gmail OAuth show advanced](https://wpmailsmtp.com/wp-content/uploads/2021/10/gmail-oauth-show-advance.png)#### What if I want to switch to a different email later?

If you’d like to change to a different Gmail or Google Workspace email address, you’ll need to repeat all the tutorial steps above. This includes generating a new Client ID and Client Secret under this other email account.

When you get to the Authorization step ([Step 4](#permissions)), save your settings and click the **Remove Connection** button. This will remove the authorization for your original email account and allow you to repeat the authorization steps with your new email.

![Remove connection in WP Mail SMTP](https://wpmailsmtp.com/wp-content/uploads/2020/10/Remove-Connection-in-WP-Mail-SMTP.png)#### Does the Google Workspace / Gmail mailer support aliases?

Yes, as of July 2020, WP Mail SMTP supports Gmail aliases. For more details on how to set up an alias in Google, check out its guide on [how to send emails from an alias](https://support.google.com/mail/answer/22370?hl=en).

#### Can I use the Google Workspace / Gmail mailer if I have 2 Factor Authentication (2FA) enabled on my Google account?

You can definitely use 2 Factor Authentication with WP Mail SMTP’s Google Workspace / Gmail option. However, it’s important to note that if you choose to disable 2FA, or change the password on your account, you’ll need to go through the [setup process](#create-app) again.

#### When authorizing my app, I get the following error message:

`Error 403: access_denied. The developer hasn’t given you access to this app.`

This message means that your app’s permissions are set to the testing mode in Google Cloud.

To fix this, be sure to [switch the mode from testing to production](#from-testing-to-production) and try authorizing your app one more time.

#### If I change my password, will I need to reconnect?

Yes, if your password is changed, the existing connection will be invalidated. To fix this, you will need to create a new connection, using your new credentials.

#### Do I need to submit my app to Google for verification in order for it to work with WP Mail SMTP?

It isn’t required for you to submit your app for verification. However, you’re welcome to do so if you’d like. If you choose to submit your app for verification, you can continue the [authorization process in WP Mail SMTP](#permissions) without waiting for Google’s verification.

#### Why is the redirect URI pointing to connect.wpmailsmtp.com?

We set the redirect URI to pass through our site so we can resolve the 403 forbidden error some users experience when `mod_security` prevents them from completing the OAuth connection.

**Note:** The redirect URI is added for verification purposes alone. We don’t store or have access to any data from your website.

#### How do I change the redirect URI so it points to my own site?

If you prefer not to use the default OAuth redirect URI (`connect.wpmailsmtp.com`) for added security and privacy, you can easily redirect it to your own website.

To do this, you’ll first need to add the following code snippet to your WordPress site.

**Note:** For help with adding snippets to your site, please see our tutorial on [adding code snippets using the WPCode plugin](https://wpmailsmtp.com/docs/using-code-snippets/).

Next, head to your mailer settings in **WP Mail SMTP » Settings » General**  and copy the new URL from the **Authorized redirect URI** section.

Finally, go to your Google App’s [OAuth Client ID settings](https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/#oauth) and replace the existing redirect URI with the one you’ve just copied. This ensures that the authorization requests will now be directed to your own website.

#### When adding the redirect URI, I get the following error message:

`Invalid source: URIs must not contain a path or destination with “/”`

This error occurs when you add the redirect URI to the **Authorized JavaScript origins** section instead of the **Authorized redirect URIs** section.

To resolve this issue, remove the URI you added from the Authorized JavaScript origins section and add it to the Authorized redirect URIs section. See the [client ID](#oauth) section for additional details.

#### What should I do if I encounter a “redirect\_uri\_mismatch” error during setup?

This error usually means there’s a mismatch in the **Authorized redirect URI** in your Google Cloud Console. It should be set to `https://connect.wpmailsmtp.com/google/`. Also, ensure that for your Google app, you’ve [updated the publishing status from Testing to Production](#from-testing-to-production).

For more guidance on fixing this error, please see SendLayer’s documentation on resolving the [Redirect URI Mismatch error](https://sendlayer.com/docs/error-redirect-uri-mismatch/).

#### WP Mail SMTP periodically stops working, and I keep getting the following error message:

`"Mailer: Google / Gmail{"error": "invalid_grant","error_description": "Bad Request"}`

This error usually indicates that there are permission issues due to the Client Secret key being invalidated. It could happen when you change your Gmail password or enable 2FA on your account.

To resolve this, you’ll either need to regenerate your tokens or go through the [setup process](https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/#create-app) again.

To regenerate your tokens, log in to the [Google Cloud Console](https://console.cloud.google.com/home/dashboard), then select **Credentials** under the **API & Services** section.

![api credentials page](https://wpmailsmtp.com/wp-content/uploads/2022/11/api-credentials.png)On the **OAuth 2.0 Client IDs** section, you’ll need to click the pencil icon to edit your credentials.

![Click pencil icon](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-pencil-icon.png)Next, scroll to the Client secrets section and click **+ Add secret** to generate a new key.

![reset client secret](https://wpmailsmtp.com/wp-content/uploads/2025/12/add-secret.png)After generating the new secret, you’ll need to update the Client Secret in WP Mail SMTP settings with the new key. Go ahead and copy the **Client Secret** key.

![copy client secret key](https://wpmailsmtp.com/wp-content/uploads/2025/12/copy-client-secret.png "copy client secret key")Google recommends disabling and deleting inactive Client secrets. Be sure to delete the ones you’re not actively using.

Then log in to your WordPress dashboard and go to **WP Mail SMTP » Settings**.

![General tab SMTP settings](https://wpmailsmtp.com/wp-content/uploads/2022/12/general-settings-wp-mail-smtp.png)On the **General** tab, scroll down to the **Google / Gmail** section and paste the key you copied into the **Client Secret** field.

![enter new client secret](https://wpmailsmtp.com/wp-content/uploads/2022/11/enter-new-client-secret.png "enter new client secret")Once you’ve added the new Client Secret, be sure to save your changes.

#### After sending a test email, I see the following error message:

`The test email might have been sent, but its deliverability should be improved.`

This error usually occurs if you’re using a custom domain email address and haven’t added SPF and DKIM records for the domain. You’ll need to add both records to your domain’s DNS to fix this issue.

If you’re seeing the following SPF error message:

![missing spf record](https://wpmailsmtp.com/wp-content/uploads/2022/11/missing-spf-record.png)It means your domain is missing the SPF record required by Google to verify your domain. To fix this, you’ll need to add the SPF record to your domain’s DNS. For steps on how to access this record, check out [Google’s SPF](https://support.google.com/a/answer/33786?hl=en&ref_topic=9061731) guide.

You’ll likely see two options on the Google SPF documentation page: **Define your SPF record—Basic** and **Define your SPF record—Advanced**. Follow the steps in the Basic option to get your SPF record. Then proceed to add the record to your domain’s DNS.

**Note:** If you’d like to learn how to add DNS records to your domain’s DNS, be sure to check our [DNS records](https://wpmailsmtp.com/docs/how-to-add-dns-records-for-wp-mail-smtp-setup/) guide for more information.

If you’re seeing the following DKIM warning:

![dkim record error](https://wpmailsmtp.com/wp-content/uploads/2022/11/dkim-record-error.png)You’ll need to add the DKIM record required by Google to verify that emails come from authorized domains. For steps on how to get this record, check out [Google’s DKIM guide](https://support.google.com/a/answer/174124?hl=en&ref_topic=2752442 "Google's DKIM guide").

You may also see the following error message after sending a test email:

![multiple spf record error](https://wpmailsmtp.com/wp-content/uploads/2022/11/spf-record-error.png)This error indicates that you’ve added multiple SPF records to your domain’s DNS. If you’ve previously added an SPF record from a different mailer, you’ll likely encounter this error. For steps on how to resolve this issue, check out our guide to learn [how to merge all SPF records](https://wpmailsmtp.com/fix-multiple-spf-records/) on your domain’s DNS.

That’s it! Now you know how to set up WP Mail SMTP’s Google Workspace / Gmail mailer on your WordPress site.

Next, would you like to know how to effectively troubleshoot issues in WP Mail SMTP? Be sure to check out our tutorial on [troubleshooting WP Mail SMTP](https://wpmailsmtp.com/docs/how-to-troubleshoot-wp-mail-smtp/) for more details.

**Categories:** Mailers

---

