From autonomous agent sign-ups to CI pipeline testing — every workflow where machines need email.
Your AI agent needs to create accounts on third-party services. That means email verification, OTP codes, and confirmation links. SpawnMail gives each agent run a fresh inbox, waits for the verification email, and hands back structured data your agent can act on.
/wait blocks until email arrives
import requests
# 1. SpawnMail a disposable inbox
inbox = requests.post("/inboxes",
headers={"x-api-key": KEY}
).json()
# 2. Use it to sign up
agent.create_account(email=inbox["address"])
# 3. Wait for verification email
email = requests.get(
f"/inboxes/{inbox['id']}/wait",
headers={"x-api-key": KEY}
).json()
# 4. Extract OTP and verify
otp = extract_code(email["body_text"])
agent.verify(code=otp)
# 5. Clean up
requests.delete(f"/inboxes/{inbox['id']}",
headers={"x-api-key": KEY}
) Every test run gets a fresh inbox. No more shared test@company.com mailboxes with flaky state from previous runs. SpawnMail integrates into your CI pipeline so email-dependent tests are deterministic and parallelizable.
# In your test setup
$ INBOX=$(spawnmail create --json | jq -r '.address')
# Run your E2E test
$ playwright test --env TEST_EMAIL=$INBOX
# In the test: wait for password reset email
$ spawnmail wait $INBOX_ID --timeout 30
→ { subject: "Reset your password" }
# Extract the reset link
$ spawnmail read $INBOX_ID --json \
| jq -r '.body_html' \
| grep -oP 'href="\K[^"]*reset[^"]*'
# Teardown
$ spawnmail destroy $INBOX_ID Run multiple agents with complete data isolation. Each customer, each workflow, each agent gets its own inbox namespace. No cross-contamination, no shared state, no accidental data leaks between tenants.
# Provision inbox per tenant workflow
def run_agent_for_tenant(tenant_id: str):
inbox = requests.post("/inboxes",
json={
"ttl_seconds": 3600,
"password": tenant_secrets[tenant_id]
},
headers={"x-api-key": KEY}
).json()
# Agent operates with isolated inbox
result = agent.execute(
email=inbox["address"],
tenant=tenant_id
)
# TTL auto-cleans, or destroy now
requests.delete(
f"/inboxes/{inbox['id']}",
headers={"x-api-key": KEY}
)
return result Agents that monitor email notifications — order confirmations, shipping updates, security alerts. SpawnMail gives each monitoring agent a dedicated inbox that delivers structured data the moment something arrives.
# Create a long-lived monitoring inbox
inbox = requests.post("/inboxes",
json={"ttl_seconds": 86400 * 30},
headers={"x-api-key": KEY}
).json()
# Subscribe to shipping notifications
store.set_notification_email(inbox["address"])
# Poll for new emails
while True:
email = requests.get(
f"/inboxes/{inbox['id']}/wait",
params={"timeout": 120},
headers={"x-api-key": KEY}
).json()
if "shipped" in email["subject"].lower():
agent.process_shipment(email)