---
title: "Stop using Gmail as the inbox for your test codes · Proxy Mail QA"
description: "Reading sign-up codes from a Gmail inbox in automated tests means OAuth set-up, tokens that lapse and a person signing in to renew them. What to use instead."
url: https://proxymail.qa/solve/gmail-test-inbox
---

1. [Home](https://proxymail.qa/)
2. [What we solve](https://proxymail.qa/solve)

# Stop using Gmail as the inbox for your test codes

It starts simply: a team Gmail account, plus-addresses for each test, and a script that reads the code. Months later the tests fail on Monday mornings because a token lapsed, two runs read each other's codes, and someone has to sign in by hand to fix it.

Updated 13 November 2026

Using a real Gmail account as the test inbox works at first. These are the ways it usually breaks.

## Where it breaks

- **Tokens lapse.** An OAuth app whose consent screen is in Testing gets refresh tokens that expire after 7 days. The pipeline fails until someone signs in and copies a new token in.
- **Restricted scopes.** Reading mail needs one of Gmail’s restricted scopes. Moving the app out of Testing can mean Google’s verification and, for some uses, a security assessment, which is a lot for a test helper.
- **One inbox for every run.** Plus-addresses (`qa+run123@gmail.com`) give each test its own address, but every email still lands in the same mailbox. Parallel runs read each other’s codes, and a retry can pick up the code from the previous attempt.
- **Fixed waits and fragile parsing.** Scripts poll with `sleep`, then pull the code out with a regular expression that breaks the day marketing changes the email template.
- **A person in the loop.** When Google asks to confirm the sign-in, a test can’t answer. Someone with the phone has to.

## One address per test instead

Proxy Mail QA gives each test its own address and inbox, then waits for the email that arrives after a given time:

TypeScript

```ts
import { ProxyMailQA } from 'proxymail-qa';

const qa = new ProxyMailQA(); // reads PROXYMAIL_QA_API_KEY
const { address } = await qa.createAddress({ label: 'sign-up test' });

const since = new Date();
// …fill in the sign-up form with `address` and submit…
const { value: code } = await qa.waitForCode(address, { since });

```

- **No tokens to renew.** An API key doesn’t expire after a week. Keep it in your CI secrets.
- **No collisions.** Each address belongs to one test, so parallel runs never see each other’s mail.
- **No regular expressions.** The code or link comes back on its own, with the time it arrived.
- **No fixed sleeps.** The wait returns as soon as the email arrives, and `since` means an older code can’t come back.

## Moving over

1. Swap the Gmail address in your sign-up step for a new address from `createAddress`.
2. Replace the inbox polling and the regular expression with `waitForCode` or `waitForLink`.
3. Remove the Gmail credentials from CI, and the job that renews the token.

The [Playwright](https://proxymail.qa/solve/playwright-email-tests), [Cypress](https://proxymail.qa/solve/cypress-email-tests) and [pytest](https://proxymail.qa/solve/pytest-email-tests) guides show the same steps in each framework.

## Automating this?

Replace the Gmail step with two calls: create an address with createAddress, then waitForCode with since set to just before you submit. The npm package, the Python helper and the REST API all do this, and no token ever needs renewing.

[Node.js client](https://proxymail.qa/docs/node) [Python](https://proxymail.qa/docs/python) [Set up your coding agent](https://proxymail.qa/docs/api#agent-setup)

## Try it on your next sign-up test

Free plan, no credit card. Create an address and watch the code or link arrive.

[Create a free account](https://app.proxymail.qa/?mode=signup&from=site-solve-gmail-test-inbox)

## Questions

### Why does my Gmail token stop working after a week?

If your Google Cloud project's OAuth consent screen is in Testing, Google expires its refresh tokens after 7 days (unless the app asks only for name, email and profile, which can't read mail). Publishing the app avoids that, but Gmail's read scopes are restricted, so a published app may need Google's verification first.

### Can't I just use IMAP with an app password?

App passwords need 2-Step Verification on the account, and an organisation's Google Workspace admin can turn them off. Even when they work, every test still shares one inbox and has to pick its email out of everyone else's.

### Gmail plus-addressing gives every test its own address. Isn't that enough?

It gives each test its own address, not its own inbox. Everything still lands in one mailbox, so your script has to search for the right email, and a slow email can be matched to the wrong test. Some sign-up forms also refuse + addresses.

### What about a second Gmail account just for testing?

Google may block sign-ins from browsers controlled by automation software, and a new account can be asked to confirm a phone number. Either way, a person has to step in, and that one account becomes the shared inbox again.

## Related guides

- [Test sign-up and email verification](https://proxymail.qa/solve/email-verification-testing): A fresh, private address for every sign-up test, with the verification link or code ready the moment it lands.
- [Test OTP and one-time login codes](https://proxymail.qa/solve/otp-code-testing): Codes pulled out of the email with a Copy button and a countdown when the email says how long they last.
- [Test magic links and passwordless sign-in](https://proxymail.qa/solve/magic-link-testing): Single-use links that are never opened or prefetched on our side, so they still work when you click them.
- [Test password reset emails](https://proxymail.qa/solve/password-reset-testing): Request, receive and use reset links, and keep the new password saved next to the test account.
- [Stop sharing one Gmail inbox for QA](https://proxymail.qa/solve/shared-test-inbox): Private, disposable addresses for every tester instead of one shared mailbox and a pile of plus-addresses.
- [Email limits in auth providers while you test](https://proxymail.qa/solve/auth-email-limits): Supabase's 2 an hour, Firebase's 5 email links a day, Auth0's 10 a minute and Clerk's 100 a month, and how to send your own.
- [Let test addresses through a disposable-email block](https://proxymail.qa/solve/disposable-email-blocks): Keep the block for real users and let your test domains through in development and staging, with one setting you can't ship by mistake.
- [CAPTCHA, Google and Apple sign-in in tests](https://proxymail.qa/solve/captcha-and-social-sign-in-tests): Published test keys for reCAPTCHA, hCaptcha and Turnstile, and what to test instead of automating Google and Apple sign-in.
- [Take QA notes by voice with Wispr Flow](https://proxymail.qa/solve/voice-notes-wispr-flow): Dictate what each test account is for, its state and what you found, straight into its notes, in seconds.
- [Test phone-first sign-up without real SMS](https://proxymail.qa/solve/phone-first-sign-up-testing): Test numbers with fixed codes, a test-mode code kept out of release builds, and why virtual numbers usually fail.
- [Test sign-up for people in China](https://proxymail.qa/solve/china-sign-up-testing): Real-name rules, a 姓名 field and province menus, a safe test code, and 身份证 numbers that can't be anyone's.
- [Test sign-up for people in Japan](https://proxymail.qa/solve/japan-sign-up-testing): Furigana fields, 全角 and 半角, postcode lookups and LINE sign-in, with test accounts that have Japanese names.
- [Made-up test accounts, not masked production data](https://proxymail.qa/solve/synthetic-test-data): A masked copy of production still holds real people. Test sign-up with made-up accounts that no one owns instead.
- [Test sign-up for people in India](https://proxymail.qa/solve/india-sign-up-testing): Test accounts with one name, PIN codes that agree with the city, phone-first sign-up, Hindi labels, ID fields and card mandates.
- [Test sign-up for people in Pakistan](https://proxymail.qa/solve/pakistan-sign-up-testing): Test accounts with Pakistani names in both scripts, CNIC fields that never hold a real number, and phone-first sign-up.
- [Fill phone and ID fields safely](https://proxymail.qa/solve/phone-id-and-tax-number-fields): Numbers set aside for fiction, your app's own test numbers, ID values that never match a real person, and KYC sandbox values, filled the same way by agents and tests.
- [Verification link points to localhost:3000](https://proxymail.qa/solve/localhost-links): Why emails from staging link to localhost, how to fix it in Supabase, Firebase and other stacks, and how we flag it.
- [Common Supabase sign-up and login problems](https://proxymail.qa/solve/supabase-auth-problems): Emails that never arrive, links that expire or sign nobody in, and sign-ups that fail, with the fix for each.
- [Common Firebase sign-up and login problems](https://proxymail.qa/solve/firebase-auth-problems): Missing verification and reset emails, verified users who still look unverified, failing links and sign-up limits, with the fix for each.
- [Sign-up and login problems in vibe-coded apps](https://proxymail.qa/solve/vibe-coded-login-problems): The login bugs AI-built apps usually ship with: emails only you receive, links to the preview, missing pages, and what to ask the builder.
- [Check that one user can't see another's data](https://proxymail.qa/solve/vibe-coded-app-data-leaks): A curl with the anon key for tables anyone can read, and two signed-up accounts for policies that let every user read every row.
- [Triage sign-up and login bug reports with an agent](https://proxymail.qa/solve/bug-report-triage): An agent signs up with a new test address, watches the inbox, and answers replicated, not replicated or inconclusive, with the evidence.
- [A self-improvement loop for agents that build sign-up](https://proxymail.qa/solve/agent-self-improvement-loop): The agent builds, signs up with a test address, reads what the email did, fixes its own work and runs again. Proxy Mail QA is the tool it checks with.
- [Test sign-up emails in Playwright](https://proxymail.qa/solve/playwright-email-tests): A complete Playwright test for sign-up codes and links, from a fresh inbox to the report on the pull request.
- [Test sign-ups over several screens](https://proxymail.qa/solve/multi-step-sign-up-testing): One test account across every screen of the sign-up, with your form's own questions filled the same way each time.
- [Test sign-up emails in Cypress](https://proxymail.qa/solve/cypress-email-tests): A complete Cypress test for sign-up links and codes, with the email waits running as Cypress tasks.
- [Test sign-up emails with pytest](https://proxymail.qa/solve/pytest-email-tests): A complete pytest test for sign-up codes and links, with Playwright for Python or Selenium and a one-file helper.
- [Test coupon codes and welcome offers](https://proxymail.qa/solve/coupon-code-testing): The coupon with its discount, end date and arrival time, what checkout did with it, and a failure when an expired or reused one is accepted.
- [Test unsubscribe links and one-click unsubscribe](https://proxymail.qa/solve/unsubscribe-testing): The unsubscribe headers and link checked on every marketing email, and a watch that flags any marketing after unsubscribing, with no time limit.
- [Test that a welcome offer can't be claimed twice](https://proxymail.qa/solve/welcome-offer-abuse): Versions of one address that reach the same inbox, and a check that fails when the same person got the offer more than once.
- [AI sign-up page review](https://proxymail.qa/solve/ai-sign-up-page-review): Let an agent check the sign-up through to the email: delivery, the link, how it was sent, and that only one arrives.
- [AI registration page review](https://proxymail.qa/solve/ai-registration-page-review): An agent tries every field with values made for it, then finishes the registration through the email.
- [Review a sign-up page by hand](https://proxymail.qa/solve/how-to-review-my-sign-up-page): A checklist for your browser and phone, in the order that finds the most problems.
- [Review a simple sign-up form](https://proxymail.qa/solve/review-a-simple-sign-up-form): 12 checks for a form with an email, a password and perhaps a name.
- [Review a multi-page sign-up form](https://proxymail.qa/solve/review-a-multi-page-sign-up-form): One test account across every screen, and the verification email wherever it comes.
- [Review a financial sign-up form](https://proxymail.qa/solve/review-a-financial-website-sign-up-form): The emails, age and country rules and awkward values in a financial sign-up, and what needs other tools.
- [An email address for testing registration](https://proxymail.qa/solve/email-for-checking-my-registration-form): A new, real address for every registration try, with the code or link ready to use.
- [An email address for testing sign-in](https://proxymail.qa/solve/email-for-checking-my-sign-in-form): Test accounts with saved passwords and an inbox for codes, magic links and resets.
- [How long should a password be?](https://proxymail.qa/solve/how-long-should-my-registration-form-password-be): NIST's numbers for password length and rules, and test passwords to check yours.
- [No error for a password that breaks the rules](https://proxymail.qa/solve/why-is-my-registration-form-not-showing-password-errors): The eight usual causes of a silent password field, and how to tell which one it is.
- [Help me check my website](https://proxymail.qa/solve/help-me-check-my-website): A whole-site check in an afternoon, in the order that finds the costliest problems first.
- [Tools to build and check a website](https://proxymail.qa/solve/tools-to-help-build-and-check-my-website): A toolkit by area, most of it free and none of it ours, except for account emails.
- [What tools do I need for a website?](https://proxymail.qa/solve/what-tools-do-i-need-when-building-a-website): The full list, then which parts a simple site can skip.

[Built your app with an AI tool? Pick yours](https://proxymail.qa/built-with)
