Email testing: assert on the messages your app sends

Email testing is the practice of treating email as part of your test suite instead of a leap of faith. The messages your app sends — signup confirmations, one-time codes, password resets, receipts — gate your most critical flows, and they break quietly. Tempx gives every test run a real, disposable inbox: mail arrives in seconds, the inbox is readable in the web app, the browser extensions or programmatically, and everything deletes itself. Nothing is ever delivered to a real person.

What to test

FlowWorth asserting
Signup confirmationMail arrives within your timeout; the link matches your expected host and token shape.
OTP / login codesThe code is present, matches your format (e.g. 6 digits), and a fresh request invalidates the old one.
Password resetThe token is single-use, expires, and the reset actually completes end to end.
Transactional & notification mailSubject and template render the live data (order number, name), not placeholder text.
Staging sanityStaging senders really point at staging — no customer ever receives a test run.

Three ways to run it on Tempx

  1. SMTP capture for the sending side. Point your app's mailer at the capture-only gateway and inspect what it “sends”. Covered in SMTP testing.
  2. Hand the loop to an AI agent. Over MCP, an agent can wait for the message and check the flow itself — see Tempx for AI Agents.
  3. Watch it like a human. The web inbox and the Chrome/Firefox extensions show every arriving message live — the fastest sanity-check while you build the flow.

Example: wait for the code instead of polling for it

// over MCP: block until the message exists, then read it
const msg = await tempx.callTool("wait_for_email", {
  since: "2 minutes ago",
  subjectRe: "verify|confirmation",
});
const code = msg.text.match(/[0-9]{6}/)?.[0];

Each message carries from, subject, a text preview and timestamps, so the assertion stays in your usual test framework — and for a human in the loop, the same message shows up live in the web inbox and the browser extensions. For the full patterns — OTP extraction, retry windows, parallel-worker naming — see the guides on testing email verification and testing OTP emails.

Common failure modes worth testing for

Related