Skip to content

Ephemeral Test Inboxes & OTP Extraction API

Last updated 28 October 2026

Testing authentication, password resets, and signup flows with real emails is notoriously flaky. SadaSend provides instant ephemeral test inboxes with an event-driven waitForCode API—no polling or IMAP scrapers needed.

SadaSend REST APIs, Port 587 ESMTP submission relay, hosted MCP tools for AI agents, and official zero-dependency TypeScript and Python SDKs are live in production. Every account receives 6,000 monthly transactional emails with strict server-enforced guardrails.

Why ephemeral test inboxes matter

Automated end-to-end tests (Playwright, Puppeteer, Cypress) that verify signup or login funnels typically break when testing email delivery. Developers resort to polling third-party IMAP servers, running local test servers with complex networking, or disabling email verification in staging environments.

SadaSend provides instant, cloud-hosted ephemeral mailboxes on test.sadasend.com engineered specifically for test suites and browser automation agents.

The waitForCode API: Sub-150ms OTP extraction

Instead of writing polling loops that wait 5 seconds and check an inbox, your test script calls waitForCode which resolves immediately when the message arrives:

TYPESCRIPT
import { test, expect } from '@playwright/test';
import { SadaSend } from 'sadasend';

const client = new SadaSend({ apiKey: process.env.SADASEND_API_KEY });

test('User registration with 2FA email verification', async ({ page }) => {
  // 1. Generate an ephemeral test email address
  const testEmail = `user-${Date.now()}@test.sadasend.com`;

  // 2. Trigger your application's signup form in Playwright
  await page.goto('https://staging.acme.ai/signup');
  await page.fill('input[name="email"]', testEmail);
  await page.click('button[type="submit"]');

  // 3. Wait for the 6-digit OTP code to arrive (resolves in < 150ms)
  const result = await client.testing.waitForCode({
    to: testEmail,
    timeoutMs: 15000,
  });

  // 4. Enter the extracted OTP directly into the browser form
  await page.fill('input[name="otp"]', result.otp);
  await page.click('button#verify');

  await expect(page.locator('h1')).toHaveText('Welcome to Acme AI');
});

Python SDK & browser-agent automation

Using autonomous browser agents (such as Claude Code, Cursor, or custom Selenium / Playwright bots in Python)? Extract verification codes effortlessly:

PYTHON
from sadasend import SadaSend

client = SadaSend(api_key="sada_live_sk_...")

# Generates ephemeral inbox and awaits message arrival
verification = client.testing.wait_for_code(
    to="agent-test-44@test.sadasend.com",
    timeout_ms=15000
)

print(f"Extracted 6-digit OTP: {verification.otp}")
print(f"Extracted Magic Link: {verification.magic_link}")

Supported extraction patterns

The waitForCode engine automatically extracts and parses the following data types:

• 6-digit & 8-digit OTP verification codes: e.g. 123456, 892-104.

• Magic Link authentication URLs: One-time login tokens and verification URLs.

• Password reset links: Direct password update links.

• Raw HTML & Plain Text: Full message payloads if custom regex matching is required.

Security & test isolation lifecycle

• Isolated Namespace: All test inboxes reside under *.test.sadasend.com or custom test domains.

• Zero Data Leakage: Test inboxes and extracted messages are automatically purged after 60 minutes.

• Zero Quota Penalty: Ephemeral test sends within test sandbox environments do not count against your production reputation score.