Illustration: code brackets and an SMTP plug feeding a captured test inbox

Testing Email with SMTP and MCP

There are two ways to make Tempx part of your test suite: point your application at an SMTP sandbox so every message it sends gets captured instead of delivered, or connect an AI agent over MCP so it can watch an inbox, read verification codes and compose test mail on its own. Both paths end in the same place — one disposable inbox that collects everything, shows the original recipients, and never leaks a single real email.

The model: capture, never deliver

Test runs should never send mail to real addresses. Tempx is a capture trap: your app authenticates with a personal test credential, the gateway accepts any recipient (to:, cc:, bcc: — any domain), and the message is stored in the inbox paired with that credential. The original headers are preserved so you can assert exactly what would have been sent, and nothing ever leaves the sandbox.

Your app Laravel · Node · Python · CI smtp.tempx.uk gateway · :587 STARTTLS auth: tmtp_ credential SMTP AI agent Claude · Cursor · CI bot tempx.uk/mcp JSON-RPC · read-only + send auth: tmtp-scoped tmcp_ token MCP Tempx inbox your sandbox — one per credential / connection captured read · wait · send real recipients are never reached
Both entry points — SMTP for your code, MCP for your agent — capture into one inbox. Nothing is delivered for real.

Path 1: SMTP sandbox for your application

Use this when your code sends the mail: framework mailers, background jobs, integration tests. Create a persistent inbox and an SMTP credential on the account page (the password is shown once), then point your mailer at the gateway:

MAIL_MAILER=smtp
MAIL_HOST=smtp.tempx.uk
MAIL_PORT=587
MAIL_USERNAME=tmtp_x9f3… YOUR_USERNAME
MAIL_PASSWORD=YOUR_PASSWORD
MAIL_ENCRYPTION=tls

Now send to any address — customer@example.com, ops@some-corp.net, a list of them. The gateway answers 250, captures the message, and it appears in the paired inbox within seconds with the original To/Cc intact and Bcc recorded on the envelope. Limits: up to 25 recipients per message, 10 MB per message. Your test assertions read the captured copy; your staging environment never emails a human again.

Path 2: MCP for AI agents and QA bots

Use this when an agent does the work: signing up on a site, completing an email-verification step, or watching a mailbox as part of a longer workflow. Pair from the account page (or the one-command Claude pairing): the connection is scoped to one inbox, carries explicit permissions (read, search, wait, optional send), expires on a date you choose, and can be revoked instantly.

The agent then gets a small toolbox: list_emails, get_email, search_emails, wait_for_email (a server-side long-poll that returns the moment a matching message arrives), and with the send permission send_email — which composes mail to up to 10 recipients and captures it in the same inbox, Mailtrap-style:

tools/call wait_for_email
{ "from_contains": "noreply@saas-app.test",
  "subject_contains": "Verify",
  "timeout_seconds": 60 }

tools/call send_email
{ "to": ["qa@example.com", "lead@example.com"],
  "subject": "Trial started",
  "text": "Welcome aboard — this copy is captured, not delivered." }

Because the token is scoped to one mailbox, a leaked or over-eager agent can never read anything else, and because sending is capture-only it cannot be abused to spam anyone.

A full agent test, end to end

The pattern below is the whole reason the MCP surface exists: an agent that completes a real sign-up flow without a human forwarding codes by hand.

1 Agent fills the signup form uses the inbox address 2 Verification mail lands in seconds wait_for_email("Verify") 3 Agent reads the code or confirmation link get_email → extract OTP 4 Assert & move on flow verified inbox expires, nothing leaks
An agent completing an email-verification step over MCP — no human in the loop, no real mailbox involved.

Which path should you use?

SMTP sandboxMCP connection
Best forYour app, framework mailers, CI integration testsAI agents, QA bots, interactive workflows
Credentialtmtp_… username + passwordtmcp_… scoped token
RecipientsAny domain, up to 25 per messageAny domain, up to 10 per message
Reading mailInbox web UI or APIFirst-class: wait_for_email long-poll, search, get
ScopeOne inbox per credentialOne inbox per token, with permissions + expiry

They compose: run your app against the SMTP credential and let the agent watch the same inbox over MCP when a test needs both sides.

Good practice

Related: Ask AI to test your email · Testing email flows with a disposable inbox · Give your email to your AI agent · Testing Resend emails

Set up your test inbox

Create an inbox, mint an SMTP credential, pair an agent — all under a minute.

Open account Try the inbox