Skip to content
FunnelGuard

Fix guide by FunnelsGuard

SMTP plugin OAuth token expired (Gmail/Microsoft 365): fix

DLV-011High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

Many WordPress mail plugins (WP Mail SMTP, FluentSMTP, Post SMTP and similar) can send through your Google or Microsoft account using OAuth. Instead of storing a password, the plugin stores a long-lived refresh token that it swaps for short-lived access tokens each time it sends.

Common reasons an OAuth mail token stops working
CauseWhere it happensTypical sign
Google Cloud app left in "Testing" statusGoogle Cloud Console, OAuth consent screenToken dies after about 7 days
Password changed or sessions revokedGoogle or Microsoft accountWorks, then stops after an account security change
Access removed in account security settingsGoogle Account > Security > Third-party access; Microsoft My Accountinvalid_grant
Token unused for a long timeMicrosoft 365 (inactive refresh tokens lapse)AADSTS700082
Admin policy or conditional access changeMicrosoft 365 admin / Entra IDSudden failures for everyone
Client secret expiredAzure app registrationAuthentication fails at the set expiry date

Why it costs you leads or sales

How a lapsed token plays out (Example)
  1. Day 0

    Mailer connected to Gmail. Test email arrives.

  2. Day 7

    Token expires or is revoked. Sends start failing quietly.

  3. Day 8

    A visitor submits the form and sees a thank-you message. No email is sent.

  4. Day 14

    Someone notices the inbox has been quiet and checks the plugin log.

  5. Day 14

    Mailer reconnected. New leads arrive again, missed ones need recovering.

Leads reaching your inbox vs submittedExample numbers
Leads reaching your inbox vs submitted (example)Submitted: 20 leads per week; Emailed (token valid): 20 leads per week; Emailed (token expired): 0 leads per week081520200SubmittedEmailed (token valid)Emailed (token expire…leads per week

Example: 20 leads are submitted each week. With a valid token all 20 are emailed; with an expired token none are.

How to check if your site has it

Check the mailer
  1. Open the plugin's status or settings pageWordPress

    In WP Mail SMTP, go to WP Mail SMTP > Settings and look for a notice that authorization is missing or expired. In FluentSMTP, check Settings > Connections.

  2. Send the plugin's test emailWordPress

    Use the Email Test tab (WP Mail SMTP) or the test option in your mailer. An authorization error here confirms the token problem.

  3. Read the email log or debug eventsWordPress

    Look for failures containing invalid_grant, AADSTS700082, 401 or "token expired or revoked". Email logging is off by default in some plugins, so enable it if you see nothing.

  4. Check the account side

    In Google, open your Google Account > Security > Your connections to third-party apps and services. In Microsoft 365, check My Account and the Entra ID app registration for the app and its secret expiry date.

  5. Submit your own form

    Fill in the live form with a test name and an email you control, then see if the notification arrives within a few minutes.

How to fix it

Where the lead is lost
  1. Visitor submits formThank-you message shown
  2. Plugin asks Google/Microsoft to sendUses stored OAuth token
  3. Mail provider refusesinvalid_grant / 401
  4. Owner inboxNo notification

The form works, but the send step is refused, so the owner never hears about the lead.

Reconnect the mailer
  1. Re-authorize the connection

    In WP Mail SMTP, open Settings, choose your Gmail or Outlook mailer and click the button to remove and then re-connect the account, accepting the permissions. In FluentSMTP, edit the connection and click Authenticate again.

  2. Fix the cause on the Google side

    If you use your own Google Cloud project, open APIs & Services > OAuth consent screen and set Publishing status to In production. Apps in Testing status get refresh tokens that expire after about 7 days. Then re-authorize.

  3. Fix the cause on the Microsoft side

    In Microsoft Entra ID > App registrations, open your app, check Certificates & secrets for an expired client secret and create a new one. Paste it into the plugin and re-authorize.

  4. Send the test email

    Use the plugin's test tool, then submit the real form.

How to confirm it's fixed

Confirmation checklist
  • The plugin's test email arrives in the owner inbox
  • A real submission on the live form arrives within a few minutes
  • The email log shows the send as successful, with no invalid_grant or 401
  • The email is not in spam and the Reply-To is the lead's address
  • You have noted when the Google or Microsoft app secret or token will next need attention
Before and after reconnecting

Token expired

  • Form shows success
  • Plugin log shows invalid_grant or AADSTS700082
  • Inbox stays empty

Token valid

  • Test email arrives
  • Log shows successful sends
  • Every lead is emailed to the owner

How to prevent it happening again

Prevention
  • Publish your Google Cloud OAuth app (not Testing status)
  • Put the Microsoft client secret expiry date in a shared calendar with a reminder a month ahead
  • Use a dedicated sending account, not a person's mailbox, and keep it out of password-reset or security clean-ups
  • Turn on email logging and failure alerts in your mailer plugin
  • Keep form entries saved in the site or CRM as a backup
  • Run a scheduled end-to-end test of the form so a silent failure is caught within a day

How FunnelGuard handles this

Toggle the token stateInteractive
OAuth token expired

Expired

Leads or data lost

The form shows a thank-you message, but the mail provider refuses the send and no notification arrives.

The visitor sees the same success message either way. Only the inbox shows the difference.

Questions people ask

Why did my WordPress form emails stop after connecting Gmail?

The most likely reason is that the OAuth token your SMTP plugin uses was revoked or expired. A Google Cloud app left in Testing status is a common cause, as its tokens last about 7 days. Reconnect the account in the plugin and publish the app.

What does invalid_grant mean in WP Mail SMTP?

It means Google rejected the refresh token the plugin stored. The token expired, was revoked, or the account's security changed. Re-authorize the mailer in the plugin settings to get a new one.

How do I fix AADSTS700082 on Microsoft 365?

AADSTS700082 means the refresh token expired from inactivity. Reconnect the account in your mail plugin. Also check the Azure app registration for an expired client secret and replace it if needed.

How long does a Gmail OAuth token last for an SMTP plugin?

Normally it lasts until revoked, but if your Google Cloud app is in Testing status, the refresh token expires after about 7 days. Setting the consent screen to In production avoids that. Password changes or removed app access also end it.

Will I lose the leads sent while the token was expired?

The emails are not resent automatically. If your form plugin saves entries or sends leads to a CRM, you can find them there. If it does not, those leads may be gone, so turn on entry storage.

How can I know my form emails have stopped without checking every day?

Run a scheduled test submission that checks a test email arrives. FunnelGuard does this and alerts you when the email is missing, though it will not name the expired token as the cause. Your mailer's log shows the exact error.

Is it better to use OAuth or an SMTP password for form emails?

OAuth avoids storing a password, but depends on a token that can lapse. A dedicated transactional email service or site-specific SMTP account is often more stable, as long as SPF and DKIM are set up.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: Missing email detected; cause not named.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.