# Disposable email API for reliable automated tests

Create private disposable email addresses from code for Playwright, Cypress, QA, and CI. Receive real emails, extract links and OTP codes, and isolate every test run.

Create a fresh private inbox for every Playwright, Cypress, QA, or CI run. Receive real emails, extract verification links and OTP codes, and remove shared-mailbox failures from your test suite.

[Start testing free](https://app.mailslurp.com/sign-up/?onboardingRequest=testing) [View inbox API docs](https://www.mailslurp.com/docs/inboxes/)

PlaywrightCypressSeleniumPostmanJavaScriptPythonGitHub Actions

Trusted by top companies worldwide

- ![Broadcom](https://www.mailslurp.com/assets/companies/broadcom.svg)
- ![Scraper](https://www.mailslurp.com/assets/companies/scraper.svg)
- ![Trivago](https://www.mailslurp.com/assets/companies/trivago.svg)
- ![Avast](https://www.mailslurp.com/assets/companies/avast.svg)
- ![Wolt](https://assets-cdn.mailslurp.com/image-variants/340/assets/companies/wolt.png?v=cc1d15fdde2aa20df0302c7fefb9b5ca50546a80)
- ![Panasonic](https://www.mailslurp.com/assets/companies/panasonic.svg)

## Give every test run its own clean inbox

Provision an isolated email address for each test, worker, or customer journey. Signup, password-reset, invitation, and notification emails arrive in the inbox owned by that run, so parallel tests can execute without collisions.

[Explore email testing](https://www.mailslurp.com/product/email-integration-testing/)

![Playwright, Cypress, and Postman test runs creating a fresh MailSlurp inbox](https://www.mailslurp.com/_astro/frameworks-to-inbox-v1.BoxB0Atn_KOKFb.png)

Worker 01

Passed

Worker 02

Passed

Worker 03

Passed

### Run tests safely in parallel

Create one address per worker so concurrent signup and recovery tests never consume another run's email.

![PDF document titled YourDelivery received by an automated test](https://www.mailslurp.com/_astro/yourdelivery-pdf-transparent-v2.qORY77We_2bhsfg.png)

### Wait for the message that matters

Match the sender, subject, unread state, and time window, then inspect delivered files such as YourDelivery PDFs.

![Automated browser test entering an OTP code on a login screen](https://assets-cdn.mailslurp.com/image-variants/1024/assets/home/otp-test-fill.png?v=cc1d15fdde2aa20df0302c7fefb9b5ca50546a80)

### Continue the browser journey

Extract the link or code and complete the same signup, login, invitation, or reset flow in the browser.

## Connect your agents

Give Claude, ChatGPT, Gemini, Copilot, and your own agent runtime scoped access to real test inboxes through MailSlurp.

![MailSlurp](https://www.mailslurp.com/assets/branding/mailslurp-logo-icon-transparent.svg)

## Test the email journeys customers depend on

Use real delivered email to verify the complete application flow, not only whether a template or send call succeeded. Watch a Playwright test create an inbox, trigger the message, and continue the browser journey.

[Test signup with Playwright](https://www.mailslurp.com/blog/playwright-email-testing/)

![Verification email with a Click here to verify button being selected](https://www.mailslurp.com/_astro/magic-link-click-transparent-v2.qoAXSVH6_Z1Kkm2e.png)

### Password reset and magic links

Extract a reset URL or one-time sign-in link and finish the browser journey before it expires.

![Email notification checks passing in a continuous integration pipeline](https://assets-cdn.mailslurp.com/image-variants/1024/assets/home/cicd.png?v=cc1d15fdde2aa20df0302c7fefb9b5ca50546a80)

### Transactional notifications

Confirm that order, account, billing, and status events send the correct email to the expected recipient.

![Delivered email content, links, and attachments checked for errors](https://assets-cdn.mailslurp.com/image-variants/1024/assets/home/email-audit.png?v=cc1d15fdde2aa20df0302c7fefb9b5ca50546a80)

### Links, content, and attachments

Assert sender, subject, HTML, links, codes, headers, and attachments using the email that actually arrived.

## Keep test inboxes private, controlled, and temporary

MailSlurp gives your team account-owned inboxes. Tag each inbox by environment and test, set its expiry, and add teardown that deletes it after the assertions. Keep the evidence you need before cleanup.

[Compare temporary email options](https://www.mailslurp.com/product/temporary-email-api/)

![A controlled row of private test emails fading away as retention ends](https://www.mailslurp.com/_astro/inbox-retention-fade-v2.7WEihHBR_Z2oVXpM.png)

![Private MailSlurp test email protected by account credentials](https://assets-cdn.mailslurp.com/image-variants/1024/assets/home/secure-email.png?v=cc1d15fdde2aa20df0302c7fefb9b5ca50546a80)

### Private inbox ownership

Control inbox access through your MailSlurp account and API credentials rather than a public mailbox URL.

![Email envelope beside an hourglass showing automatic inbox expiry](https://www.mailslurp.com/_astro/inbox-expiry-hourglass-transparent-v2.nNyFBz0D_Z2e4h74.png)

### Explicit expiry and cleanup

Schedule inbox expiry, then manage retained messages and explicit deletion as separate cleanup steps.

![Email test result retained as evidence for a failed automated test](https://assets-cdn.mailslurp.com/image-variants/1024/assets/home/test-flow.png?v=cc1d15fdde2aa20df0302c7fefb9b5ca50546a80)

### Evidence when a test fails

Keep the permitted message evidence with your test result before deletion. Store IDs for correlation without putting reset tokens in general logs.

## Create, wait, extract, and continue from code

Provision a private inbox for the current test, submit its address through your application, wait for the matching message, and extract the verification link or code. Use MailSlurp from the framework and language your suite already runs.

Disposable inbox test examples

```typescript
import { test, expect, Page } from '@playwright/test';
import MailSlurp from "mailslurp-client";

test.describe('test email login with playwright', () => {
  test('can login and verify email address with mailslurp', async ({ page }) => {
    const apiKey = process.env.API_KEY;
    expect(apiKey).toBeDefined();

    // load playground app
    await page.goto("https://playground.mailslurp.com");
    await page.click('[data-test="sign-in-create-account-link"]');

    // create a new inbox
    const mailslurp = new MailSlurp({ apiKey })
    const password = "test-password"
    const { id, emailAddress } = await mailslurp.createInbox()

    // fill sign up form
    await page.fill('input[name=email]', emailAddress);
    await page.fill('input[name=password]', password);
    await page.click('[data-test="sign-up-create-account-button"]');

    // wait for verification code
    const email = await mailslurp.waitForLatestEmail(id)

    // extract the confirmation code (so we can confirm the user)
    const code = /([0-9]{6})$/.exec(email.body)[1];

    // enter confirmation code
    await page.fill('[data-test="confirm-sign-up-confirmation-code-input"]', code);
    await page.click('[data-test="confirm-sign-up-confirm-button"]');

    // fill out username (email) and password
    await page.fill('[data-test="username-input"]', emailAddress);
    await page.fill('[data-test="sign-in-password-input"]', password);
    // submit
    await page.click('[data-test="sign-in-sign-in-button"]');
    await page.waitForSelector("[data-test='greetings-nav']")
  });

});
```

![Playwright](https://www.mailslurp.com/assets/brands/icons/playwright.svg)![Cypress](https://www.mailslurp.com/icons/cypressjs.svg)![Selenium](https://www.mailslurp.com/assets/brands/icons/selenium.png)![Postman](https://www.mailslurp.com/assets/brands/icons/postman-brand.svg)![JavaScript](https://www.mailslurp.com/assets/brands/icons/javascript.svg)![TypeScript](https://www.mailslurp.com/assets/brands/icons/typescript.svg)![Python](https://www.mailslurp.com/assets/brands/icons/python.svg)![Java](https://www.mailslurp.com/assets/brands/icons/java.svg)![C#](https://www.mailslurp.com/assets/brands/icons/csharp.svg)![Go](https://www.mailslurp.com/assets/brands/icons/go.svg)![PHP](https://www.mailslurp.com/assets/brands/icons/php.svg)![Ruby](https://www.mailslurp.com/assets/brands/icons/ruby.svg)![Rust](https://www.mailslurp.com/assets/brands/icons/rust.svg)![Swift](https://www.mailslurp.com/assets/brands/icons/swift.svg)![WebdriverIO](https://www.mailslurp.com/assets/brands/icons/webdriverio.svg)

[See integrations](https://www.mailslurp.com/integrations/)

## See disposable email testing in action

[More on YouTube](https://www.youtube.com/@mailslurp)

### Open and verify email in Cypress JavaScript tests

### Extract email confirmation codes in Selenium tests

### Test email confirmation codes with Playwright

## How disposable email testing works

Use a private, API-controlled address to test the real email sent by your application. Each test owns the inbox, the delivered message, and the cleanup policy.

### What is a disposable email API?

A disposable email API creates a real email address on demand and gives software access to every message it receives. With MailSlurp, a test can create the address, receive email from your application, read the HTML and text, extract links or OTP codes, inspect attachments, and delete or expire the inbox when the run ends.

### How do I create a private inbox for each CI test?

Create a MailSlurp inbox at the start of the test and assign its address to one CI worker or browser session. Use bounded wait methods to receive the expected sender, subject and request window without fixed sleep delays. Set an expiry at creation, then run explicit cleanup after the assertion completes. The[ test-address guide](https://www.mailslurp.com/guides/test-email-address/) explains that lifecycle.

### How do Playwright, Cypress, and Selenium read email?

Use the MailSlurp client or Cypress plugin to create an inbox before the browser journey, enter its address, and wait for the delivered message. Extract the verification link, magic link, password-reset URL, or OTP code and continue the same test with the [Playwright guide](https://www.mailslurp.com/blog/playwright-email-testing/), [Cypress guide](https://www.mailslurp.com/blog/cypress-email-testing/), or [Selenium example](https://www.mailslurp.com/examples/receive-emails-in-java-selenium-tests/).

### Why use private test inboxes instead of public temp mail?

Public temporary-email sites can reuse addresses and expose mail through a shared web page. MailSlurp inboxes belong to your account, are protected by API credentials, can be tagged to a test or environment, and support explicit retention so parallel tests do not read another run's messages.

## Read email in Playwright, Cypress, and Selenium

Create a private disposable inbox inside the test, trigger the customer journey, wait for the delivered message, and continue in the same browser session.

### Read a received email in Playwright

![Playwright browser test reading a delivered verification email](https://www.mailslurp.com/_astro/playwright-email-testing-v1.G7nCeVPP_10B9MS.png)

Use the MailSlurp client with Playwright to create an inbox, match the signup or reset email, extract its link or OTP code, and finish the browser test.

[View the Playwright guide](https://www.mailslurp.com/blog/playwright-email-testing/)

### Test received email in Cypress JavaScript

![Cypress JavaScript test receiving email in a private inbox](https://www.mailslurp.com/_astro/cypress-email-testing-v1.C5LbeZeQ_Z2ivA32.png)

Use the MailSlurp Cypress plugin or JavaScript client to isolate each test inbox, open the delivered email, and assert links, codes, sender, subject, and content.

[View the Cypress guide](https://www.mailslurp.com/blog/cypress-email-testing/)

### Verify email and OTP codes in Selenium

![Selenium browser test extracting a verification code from email](https://www.mailslurp.com/_astro/selenium-email-testing-v1.CZfa85xl_Zp88Jz.png)

Create a real test address with the Java, C#, Python, or REST client, receive the confirmation email, and pass the extracted code back to Selenium WebDriver.

[View the Selenium example](https://www.mailslurp.com/examples/receive-emails-in-java-selenium-tests/)

## Disposable email API questions

Create private test inboxes, receive real delivered messages, and control the complete lifecycle from code.

What is a disposable email API?

A disposable email API creates private email addresses from code for tests and automated workflows. Each inbox can receive real email, wait for a matching message and expose its content through an API. Set an expiry when you create it and add a cleanup step for the end of the test. [Read the inbox API documentation.](https://www.mailslurp.com/docs/inboxes/)

Can I create a new disposable inbox for every automated test?

Yes. A test can create its own MailSlurp inbox before signup, password reset, invitation, or notification steps. Parallel workers can use separate addresses so messages and assertions never share mailbox state. [Explore email integration testing.](https://www.mailslurp.com/product/email-integration-testing/)

How do Playwright and Cypress tests read email?

Create a disposable inbox, enter its address in the browser flow, wait for the delivered email through the MailSlurp API or Cypress plugin, extract the required link or code, and continue the browser test in the same run. [Read the Playwright email guide.](https://www.mailslurp.com/blog/playwright-email-testing/) [Read the Cypress email guide.](https://www.mailslurp.com/blog/cypress-email-testing/)

Can disposable inboxes receive OTP codes and magic links?

Yes. MailSlurp receives the real message sent by your application, then lets the test extract an OTP, confirmation code, magic link, reset URL, sender, subject, headers, body content, and attachment metadata. [See authentication testing workflows.](https://www.mailslurp.com/solutions/authentication-testing/)

Are MailSlurp disposable inboxes private?

Yes. MailSlurp inboxes are controlled through your account and API credentials. They are designed for private testing and automation rather than public shared-inbox access.

Can disposable inboxes expire automatically?

Yes. Set an expiry when creating the inbox. MailSlurp periodically archives inboxes whose expiry time has passed, closing them to further sending and receiving. Manage retained messages and explicit deletion separately. For a failed test, keep the permitted evidence before cleanup; an ID alone does not preserve deleted content. [Compare temporary email lifecycle options.](https://www.mailslurp.com/product/temporary-email-api/)

Does MailSlurp have phone numbers for SMS and OTP testing?

Yes. MailSlurp provides real phone numbers that tests can control through the dashboard and API. Receive SMS messages, verify OTP and MFA flows, and isolate each automated test run alongside disposable email inboxes. [Explore programmable phone numbers for SMS testing.](https://www.mailslurp.com/product/phone-number-sms-service/)

## The complete email and SMS toolkit.

Develop and test real messaging flows, preview emails on real devices, protect deliverability, and connect AI agents—all from one platform.

[Get started](https://app.mailslurp.com/sign-up/) [View pricing](https://app.mailslurp.com/pricing/)

![Messages moving from an inbox through desktop and mobile previews to inbox placement results](https://assets-cdn.mailslurp.com/image-variants/1512/assets/home/email-sms-toolkit-connected-v4.webp?v=cc1d15fdde2aa20df0302c7fefb9b5ca50546a80)
