MailSlurp logo

product

Email address API

Create disposable, expiring, or permanent email addresses in code. Provision inboxes on demand and control full send/receive workflows through API and SDKs.

MailSlurp gives teams an email address API for creating inboxes instantly in code. Use it for signup flows, transactional notifications, support routing, OTP verification, and automated release checks.

If you are specifically evaluating throwaway inboxes for QA, start with disposable email API. If your focus is short-lived privacy workflows, see temporary email API.

Quick answer: when to use this page

  • You need to create email addresses programmatically.
  • You need deterministic inbound-email assertions in CI or automation.
  • You need one platform for both temporary and long-lived inbox models.
  • You need API control, not public shared disposable mail sites.

This page covers the provisioning question: how to create and control addresses. For adjacent workflows, start with the most specific MailSlurp page:

Need MailSlurp page
create inboxes, aliases, or custom-domain addresses in code stay on this Email address API page
receive and assert on incoming messages Receive email API
route inbound messages to webhooks and operations workflows Inbound email API
create one private inbox per test run Disposable email API
create short-lived inboxes with expiry control Temporary email API
validate recipient quality before signup or send Email validation API

Address model selection

Choose the mailbox model based on risk, lifecycle, and ownership:

Model Best for Lifecycle Typical owner
Disposable inboxes CI runs, signup tests, isolated QA checks Minutes to hours QA + engineering
Expiring inboxes Staging environments, short-lived workflows Hours to days Platform teams
Permanent inboxes Operational automations, support routing Long-lived Product + operations
Custom-domain inboxes Branded customer-facing workflows Long-lived Platform + security

Inbox API architecture pattern

  1. Provision inboxes with routing metadata (environment, test run, tenant).
  2. Use generated addresses in your app workflow.
  3. Wait for matching email using timeout and filter criteria.
  4. Extract links, codes, or payload data from message content.
  5. Dispose, expire, or archive inboxes based on policy.
import { MailSlurp } from "mailslurp-client";

const mailslurp = new MailSlurp({ apiKey: process.env.MAILSLURP_API_KEY! });

const inbox = await mailslurp.createInboxWithOptions({
  expiresIn: 60 * 60 * 1000,
  tags: ["ci", "signup-flow"],
});

await app.triggerSignup(inbox.emailAddress!);

const email = await mailslurp.waitController.waitForMatchingFirstEmail({
  inboxId: inbox.id!,
  timeout: 60_000,
  unreadOnly: true,
  matchOptions: {
    matches: [{ field: "SUBJECT", should: "CONTAIN", value: "Verify" }],
  },
});

High-value implementation paths

Governance controls worth adding early

  • Naming and tagging conventions for environment and owner.
  • Timeout budgets and retry policy for wait-for flows.
  • Automated cleanup for expiring inbox inventories.
  • Domain authentication checks (SPF, DKIM, DMARC) for custom domains.
  • Artifact logging of inbox/message IDs for post-failure debugging.

Next step

Start with a single high-risk flow, such as signup verification or password reset, implement one-inbox-per-run isolation, and enforce wait-for assertions before using the same pattern everywhere.