Skip to content

Blog

How to QA email flows in 2026 with AI

Published · Updated

Email is the part of a product that most test suites skip. Sign-up confirmation, password reset, magic links, invitations, receipts: each one crosses a real mail system, and each one breaks in ways a unit test never sees. In 2026 the work of checking them can be shared with an AI agent, if it has a real inbox to work with.

1. Give every test run its own inbox

The biggest source of flaky email tests is a shared mailbox: test A reads test B's message. Create a new address per run instead. With Mail for Bots that is one call (create_inbox over MCP or POST /api/v1/inboxes over REST), and ttl_minutes makes the inbox delete itself afterwards, so you never clean up. On Pro you can create them on your own domain.

2. Wait for the email, don't sleep

sleep(10) is either too slow or too short. wait_for_message (REST: GET /inboxes/:inbox/wait) holds the request until a matching message arrives, and you can filter by sender, subject or the address it was sent to. It returns as soon as the mail lands and times out cleanly if it never does, which is itself a useful failing test.

3. Assert on structure, not just arrival

"An email arrived" is the weakest assertion. Check the subject, the sender, that the link points to the right environment, that the code is the expected length, and that attachments are present. Messages come back with one-time codes and links already extracted, so a test reads extracted.codes[0] instead of parsing HTML.

4. Let an AI agent run the exploratory checks

Scripted tests cover the paths you thought of. An agent with an inbox can cover the rest: sign up with a plus-address, request a reset twice, use a stale link, change email, and report what it saw. Connect it once:

Terminal · Claude Code
claude mcp add --transport http mailforbots https://mailforbots.com/mcp \
  --header "Authorization: Bearer bm_YOUR_KEY"

Claude Desktop: add the same URL and header under Settings, Connectors.

Then give it a plain-language job:

Example prompt
You are QA for staging.example.com. Create an inbox, sign up with it,
confirm the account from the email, then request a password reset and
complete it. Report anything odd: slow emails, wrong links, duplicate
messages, missing branding. Delete the inbox when done.

Keep the agent's key narrow: a key limited to test inboxes cannot touch anything else. See human approval and scoped keys.

5. Put the scripted version in CI

The same REST calls work in any test runner. This guide has a full Playwright example.

A checklist for every email flow

  • Arrives within your target time (measure it, don't guess).
  • Sent from the expected name and address.
  • Links point at the right environment and work once, then expire as intended.
  • Plain-text part exists and reads well.
  • Plus-addressing (name+tag@) behaves the way your sign-up form says it does.
  • Nothing sends twice.

Free includes 3 inboxes, enough to try all of this today. Pro raises it to 100. See email testing for developers and how Mail for Bots compares with other testing tools.

Start free Read the quickstart