How does MailSlurp work?

MailSlurp lets you create and interact with email inboxes in code, tests, and online. How to enable email API in REST, CSharp, Java, NodeJS and more.

  • Table of contents


In automated tests

MailSlurp lets you create real inboxes in tests. These inboxes can have randomly assigned email addresses or specific addresses using custom domains. Inboxes can be disposable or permanent. Any email sent to the inboxes email address will be received by MailSlurp servers and stored in the inbox. You can then fetch emails stored in the inbox whenever you like.

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

You can also attach webhook listeners, wait until some condition is met, search emails with pattern matching and more. Use MailSlurp to test email related processes in automated integration tests using CypressJS, WebDriver IO, Selenium, Jest and more. Test user sign-up, email verification, lost password resets and anything email related. You can test welcome emails, invoice attachments, HTML spam analysis and more.


The typical integration test uses MailSlurp to create a new disposable inbox with a randomized email address. We use that to sign up a new user. We can then receive a welcome email directly from our tests and extract confirmation codes or validate content. A test might look like this:

  const testInbox = await mailslurp.createInboxWithOptions({
    name: 'test-inbox',
  await myApp.signUp(testInbox.emailAddress!);
  const timeout = 30000;
  const email = await mailslurp.waitForLatestEmail(, timeout);

In servers and apps

Use a REST API or SDK libraries in Java, Ruby, PHP, Go, C#, Ruby, Javascript, and more. Send templated emails to contact and groups groups. Trigger email in response to events.

// create randomly assigned email addresses instantly
const inbox = await mailslurp.createInbox();

// or use custom domains
    const customInbox = await api.createInbox("");

// send emails in code
await mailslurp.sendEmail(!, { to: [emailAddress!], body: 'Test' });

// receive emails in tests and apps
const email = await mailslurp.waitForLatestEmail(id, timeout, unreadOnly);

With an online email client

There is a visual dashboard with team access for sending and receiving emails.


Email and SMS Platform
Create a free account in 3 clicks