Why Your Gmail OAuth Connection Keeps Failing in WP Mail SMTP (And How to Fix It)
Content
If you're using the 'WP Mail SMTP by WPForms' plugin with Gmail or Google Workspace, you might have encountered a frustrating issue: your OAuth connection keeps disconnecting. This often results in emails failing to send and a recurring error message prompting you to remove and re-establish the connection.
This is a common problem with a few well-documented causes and solutions. This guide will walk you through the most frequent reasons for Gmail OAuth disconnections and how to resolve them permanently.
Common Symptoms of Gmail OAuth Disconnection
Users typically report one or more of the following issues:
- The plugin shows a "Connection removed" or similar error message.
- You see an error like "deleted_client: The OAuth client was deleted" or "401: Request is missing required authentication credential."
- Emails stop sending after a period of time (e.g., a few weeks).
- You are forced to repeatedly remove and re-add the OAuth connection in your WordPress dashboard.
Why This Happens: The Main Causes
Based on community reports and troubleshooting, these are the primary reasons for a broken Gmail OAuth connection:
1. Google App is in "Testing" Mode (Most Common Cause)
The most frequent cause of recurring disconnections is that the Google Cloud project (your API app) has not been published. An app in "Testing" mode has its OAuth tokens expire after 7 days, forcing you to re-authenticate constantly.
2. Changes to the Connected Google Account
The OAuth token is directly tied to the state of your Google account. Any of the following events will invalidate the token and break the connection in WP Mail SMTP:
- Changing your Google account password.
- Enabling or disabling 2-Factor Authentication (2FA).
- Revoking the app's access in your Google account security settings.
3. The Google API Client Was Deleted
If you or an administrator deleted the project in the Google Cloud Console, the connection will fail with a "deleted_client" error. The plugin can no longer communicate with Google because the API application it depends on is gone.
How to Fix Gmail OAuth Disconnections
Solution 1: Publish Your Google App
This is the first and most important step to stop recurring disconnections.
- Go to the Google Cloud Console.
- Select your project.
- Navigate to APIs & Services > OAuth consent screen.
- Look for the Publishing status section.
- If it says "Testing," click the PUBLISH APP button and confirm.
- Go back to your WordPress site, remove the existing Gmail connection in WP Mail SMTP, and set it up again.
Publishing the app makes the token long-lived, eliminating the 7-day expiration.
Solution 2: Recreate a Deleted Client
If you see a "deleted_client" error, the original API project is gone. You will need to:
- Create a new project in the Google Cloud Console.
- Re-configure the OAuth consent screen and credentials.
- Update WP Mail SMTP with the new Client ID and Client Secret.
- Re-establish the OAuth connection.
Solution 3: Minimize Account Changes
Avoid changing the password or 2FA settings on the Google account used for sending emails. If you must make a change, be prepared to re-authenticate the connection in WP Mail SMTP afterward.
Solution 4: Consider Using an App Password (Alternative Method)
If maintaining an OAuth connection is not feasible, you can use the "Other SMTP" mailer with an App Password. This is a secure 16-digit code generated specifically for applications like WordPress, allowing them to bypass 2FA and standard password changes.
To set this up:
- Generate an App Password for your Gmail account.
- In WP Mail SMTP, select the Other SMTP mailer.
- Use your full Gmail address as the username and the 16-digit App Password as the SMTP Password.
- Use the SMTP settings:
smtp.gmail.comon port465(SSL) or587(TLS).
By understanding these common pitfalls and solutions, you can achieve a stable and reliable email sending setup with WP Mail SMTP and Gmail.
Related Support Threads Support
-
gmail oauth delete clienthttps://wordpress.org/support/topic/gmail-oauth-delete-client/
-
2Fa O365 and app passwordhttps://wordpress.org/support/topic/2fa-o365-and-app-password/
-
Oauth connnection keeps getting disconnectedhttps://wordpress.org/support/topic/oauth-connnection-keeps-getting-disconnected/
-
Sending emails via alias through Google Mail oauthhttps://wordpress.org/support/topic/sending-emails-via-alias-through-google-mail-oauth/
-
Gmail with OTHER SMTPhttps://wordpress.org/support/topic/gmail-with-other-smtp/
-
Error Authenticatinghttps://wordpress.org/support/topic/error-authenticating-3/
-
Oauth keeps being revoked from Google apphttps://wordpress.org/support/topic/oauth-keeps-being-revoked-from-google-app/
-
Connect with Googlehttps://wordpress.org/support/topic/connect-with-google/
-
SMTP OAUth 2.0https://wordpress.org/support/topic/smtp-oauth-2-0/
-
App password notification for gmailhttps://wordpress.org/support/topic/app-password-notification-for-gmail/
-
New Mailgun IPs, Will mailgun still work ok?https://wordpress.org/support/topic/new-mailgun-ips-will-mailgun-still-work-ok/
-
Google Email Changeshttps://wordpress.org/support/topic/google-email-changes/
-
Gmail and non-gmail authenticationhttps://wordpress.org/support/topic/gmail-and-non-gmail-authentication/
-
Google suspended emailhttps://wordpress.org/support/topic/google-suspended-email/
-
Less secure apps blocked by adminhttps://wordpress.org/support/topic/less-secure-apps-blocked-by-admin/
-
gmail disconnects oftenhttps://wordpress.org/support/topic/gmail-disconnects-often/
-
Google token expires?https://wordpress.org/support/topic/google-token-expires/
-
Google Mailerhttps://wordpress.org/support/topic/google-mailer/
-
Sending emails via alias through Google Mail oauthhttps://wordpress.org/support/topic/sending-emails-via-alias-through-google-mail-oauth-2/
-
wpmailsmtp.com wants to access your Google Accounthttps://wordpress.org/support/topic/wpmailsmtp-com-wants-to-access-your-google-account/
-
Google OAuth periodical disconnectshttps://wordpress.org/support/topic/google-oauth-periodical-disconnects/