Use temporary email with Claude and other AI assistants

When an AI assistant can make API calls — through Claude Code, the Claude desktop app with tools enabled, or any AI with access to a terminal or HTTP client — you can describe what you want in plain English and let it handle the disposable inbox lifecycle for you.

The examples below work with Claude Code out of the box, since it can run shell commands directly. They also work with any AI assistant that has web browsing, tool use, or a terminal available. Swap claude for your tool of choice.

One-time setup: add your API key to your shell environment so Claude can use it without you pasting it into every prompt:

export TEMPY_API_KEY=your_key_here

Get a free key at dev.tempy.email.


Scenario 1: Create an inbox and wait for a verification email

The situation: you need to sign up for something and verify your address, but you do not want to use your real email.

Prompt:

Create a tempy.email disposable inbox using my TEMPY_API_KEY. Tell me the address. Then poll for incoming messages every two seconds and, as soon as one arrives, show me the full subject line and extract any links from the email body.

What Claude does:

  1. Calls POST https://api.tempy.email/v1/mailbox to create the inbox
  2. Prints the generated address so you can paste it into a signup form
  3. Polls GET /v1/mailbox/{address}/messages every two seconds
  4. When a message arrives, prints the subject and pulls all href values from the HTML body

Example output:

Created inbox: qa-8f2a@m7x4k.tempy.email

Waiting for messages... (polling every 2s)

✓ Message arrived after 4s
Subject: "Please verify your GitHub email address"
Links found:
  https://github.com/users/confirm?token=abc123...

You copy the link, paste it in your browser, done. The inbox expires in ten minutes automatically.


Scenario 2: Sign up for a trial without touching your real inbox

The situation: you want to try a product or download something that requires an email address. You do not want follow-up emails going to your real address forever.

Prompt:

I want to sign up for the free trial at [service URL]. Create a tempy.email inbox, navigate to their signup page, fill in the temp address and a dummy password, submit the form, then wait for their confirmation email and tell me what's in it.

What Claude does:

  1. Creates a mailbox
  2. Opens the signup URL in a browser (or uses curl if the form is simple)
  3. Fills in the temp address
  4. Polls the inbox until the confirmation arrives
  5. Summarises the email — subject, sender, key links, and any time-sensitive details (trial length, expiry date)

Tip: if the form has a CAPTCHA or multi-step flow, Claude will pause and ask you to complete those steps manually, then continue watching the inbox once you hand control back.


Scenario 3: Extract an OTP and complete a login

The situation: you are testing a login flow that sends a six-digit code by email, and you want to automate the full round-trip — request the code, catch it, submit it — without hardcoding any addresses.

Prompt:

Create a temp inbox with tempy.email. Then make a POST request to http://localhost:3000/api/auth/send-otp with body {"email": "<the temp address>"}. Wait for the email to arrive, extract the six-digit code from the body, and print it.

What Claude does:

  1. Creates the inbox, substitutes the address into your API call
  2. Fires the request against your local server
  3. Polls the inbox until the OTP email arrives
  4. Finds the first six-digit sequence in the plain-text body
  5. Prints it — and can immediately POST it to /api/auth/verify-otp if you ask

Example output:

Inbox: test-3k9b@m7x4k.tempy.email
OTP request sent → 200 OK
Waiting for OTP email...
✓ OTP received: 847203

This is the same loop that goes into a Playwright or Cypress test — but here Claude runs it interactively so you can inspect each step before automating it.


Scenario 4: Test whether your app's email is actually being delivered

The situation: you just wired up transactional email in your app and want to confirm it is sending, arriving, and looks right — without using a team member's inbox or a mail catcher that only works locally.

Prompt:

Create a tempy.email inbox. Then POST to http://localhost:3000/api/users with {"email": "<temp address>", "name": "Test User"} to trigger my welcome email flow. Wait up to 30 seconds for an email to arrive and then show me: the subject, the sender address, whether there are any broken image links, and the full plain-text body.

What Claude does:

  1. Creates the inbox
  2. Triggers your API endpoint with the temp address
  3. Polls until the email arrives (or times out and tells you why)
  4. Checks img src attributes against the list of URLs that return non-200 responses
  5. Returns a structured summary you can paste into a Slack message or ticket

Useful variation: ask Claude to do this for each of your transactional email types in sequence — signup, password reset, invoice — and collect the results into a short report.


Scenario 5: Monitor an inbox during a manual test session

The situation: you are doing exploratory testing of a multi-step flow that sends several emails at different points. You want a live feed of everything arriving in the inbox as you work through the UI.

Prompt:

Create a tempy.email inbox and print the address. Then watch that inbox continuously — every time a new message arrives, immediately print its subject, sender, and the first 100 characters of the body. Keep going until I tell you to stop.

What Claude does:

  1. Creates the inbox and prints the address so you can use it in the UI you are testing
  2. Polls every two seconds, tracking message IDs it has already shown
  3. Whenever a new message appears, prints a compact summary immediately
  4. Continues until you type "stop" or close the session

Example live feed:

Inbox: qa-9m1c@m7x4k.tempy.email

[14:02:03] From: no-reply@yourapp.com
           Subject: "Welcome to YourApp"
           Preview: "Hi Test User, thanks for signing up. Here's how to get started..."

[14:02:41] From: no-reply@yourapp.com
           Subject: "Verify your email address"
           Preview: "Click the link below to confirm your address. This link expires in 24 hours..."

[14:07:15] From: no-reply@yourapp.com
           Subject: "Your password reset link"
           Preview: "Someone requested a password reset for this address. If that wasn't you..."

This is particularly useful when testing flows where the timing between emails matters — you can see exactly when each one arrives relative to your actions in the UI.


Building your own AI tool for this

If you use Claude Code, Cursor, or another AI coding assistant regularly, you can add a reusable helper to your project once and then just ask for it by name:

// tools/tempy.ts — describe this file to your AI assistant
// "Use the tempy helper to create inboxes and wait for emails"
export { createMailbox, waitForMessage } from '../tests/helpers/tempy';

Once the helper exists in your project, prompts like "create a temp inbox and wait for the password reset email" work without Claude needing to know the API details — it just calls the helper.


What AI cannot do here

A few boundaries worth knowing:

  • Claude cannot click links on your behalf unless you are using a tool with browser control (Claude's computer use, Cursor with a browser plugin, etc.)
  • Webhooks require a publicly reachable endpoint. If your machine is behind a firewall, Claude will need a tunnel (ngrok, localtunnel) to receive pushed emails rather than polling
  • The inbox expires. tempy.email addresses last ten minutes by default. If your flow takes longer, ask Claude to create the inbox with a longer expiry or extend it before it times out

Next: Test email verification with Playwright · API reference