Temporary email api

Temporary email API for disposable email accounts. Free for personal use with REST API and clients in NodeJS, CSharp and more.

Looking for a temporary email address API? MailSlurp has a free service for creating email accounts using the temp mail api. Create a free account to obtain an api access key then install one of the official temp email clients or call the API in HTTP or GraphQL.

inbox-tool

Create temporary email accounts

If you need accounts for testing applications or email processes MailSlurp's free temp mail api can be used to create real email addresses on demand. Each inbox has an email address that can send and receive emails. You can control inboxes using the API or one of the official clients in your programming language. Let us see an example.

Setup NodeJS client

Install with npm if you use Javascript or find another client on the developer page.

npm install --save mailslurp-client

Next import the client into code or tests and set your API KEY.

// import mailslurp-client
const MailSlurp = require('mailslurp-client').default;
// OR import { MailSlurp } from "mailslurp-client"

// create a client
const apiKey = process.env.API_KEY ?? 'your-api-key';
const mailslurp = new MailSlurp({ apiKey });

Create an inbox

Use the createInbox method in the temp mail api to create an inbox:

const inbox = await mailslurp.createInbox();
// { id: '123', emailAddress: '123@mailslurp.com' }

Sending emails

Send emails from your temp mailbox using the sendEmail method:

await mailslurp.sendEmail(inbox.id, {
  to: [inbox.emailAddress],
  subject: 'test',
});

Read emails using API

You can read emails that your inboxes receive using the waitFor commands:

// wait for first email
const latestEmail = await mailslurp.waitForLatestEmail(inbox.id, timeoutMs);
expect(latestEmail.subject).toContain('test');

Get started today

MailSlurp is free for personal use and offers simple pricing for companies. Please see code examples and developer docs for more information.

Ready to dive in?Start building email applications today.