Short answer: copy the redirect URI exactly as your mail plugin shows it, add it unchanged under Authorized redirect URIs in your Google Cloud OAuth client, save, and then click the plugin’s connect button again.
Reviewed
Symptom
You connect an SMTP or mail plugin to a Google account. You click the sign-in button, and Google shows an error page that says Error 400: redirect_uri_mismatch instead of asking you to allow access.
Why it happens
Your mail plugin sends the visitor to Google with a “redirect URI”: the address on your site where Google should send you back after you sign in. Google only accepts addresses you listed in advance in your OAuth client, under Authorized redirect URIs. Google’s documentation says it plainly: if the redirect URI in the request does not match an authorized one for the client ID, you get redirect_uri_mismatch.
“Match” means exactly. Google states that the scheme (http or https), the letter case and the trailing slash must all match. So these are all different addresses to Google:
| Address | Differs because |
|---|---|
https://example.com/callback and https://example.com/callback/ | trailing slash |
http://example.com/callback and https://example.com/callback | scheme |
https://example.com/callback and https://www.example.com/callback | host name |
Google also has rules for what it accepts at all: the address must use https (addresses on localhost are exempt), the host cannot be a raw IP address (localhost IPs are exempt), and wildcard characters are not allowed.
Fix
- Copy the redirect URI from your mail plugin. Open the plugin’s Google connection screen. Most mail plugins show the exact redirect URI they will use. Copy it with the copy button or select it fully. Do not retype it.
- Open your OAuth client in Google Cloud. In the Google Cloud console, open the project you created for the plugin and go to the Clients page (Google’s documentation calls it that; where it sits in the menu changes from time to time). Open the client of type Web application.
- Add the URI. Under Authorized redirect URIs, add the copied value exactly, and save.
- Remove near-misses. Delete old entries with another scheme, host name or trailing slash, so you do not copy the wrong one later. Only delete entries you are sure nothing else uses (for example a staging site on the same client).
- Wait, then try again. Google says changes to these settings can take from 5 minutes to a few hours to take effect. Then click the connect button in your plugin again.
- If your site is on plain http or an IP address, Google will not accept that redirect URI. Put the site on https with a normal domain name first, then repeat steps 1 to 5.
- If you changed your site address (for example from http to https, or to or from www), come back to your plugin’s Google screen, copy the redirect URI it shows now, and add that one.
Check it worked
- The connect button takes you to Google’s normal “choose an account” and permission screen, and then back to your plugin, which shows the account as connected.
- Send a test email from your site and confirm it arrives. See the guide on WooCommerce emails not sending or going to spam if it does not.
How the plugin helps
Email Health Check & Log for WooCommerce does not connect to Google and does not show a redirect URI, so it cannot fix this error. What it can do afterwards: its Send Test Email form sends a message through your real mail setup and shows the result and any error right away, and its Health Report checks SPF, DKIM and DMARC for the domain you send from, including Google Workspace setup guidance with a link to Google’s own instructions. Get the plugin on WordPress.org.