Developer guide

How to get starting with MailSlurp

MailSlurp is an email API that lets you create email addresses on demand in applications and tests using REST or SDK libraries. You can also send and receive emails directly in code or have them forwarded to an application endpoint.

Install an SDK

MailSlurp is available in many languages. You can see a list of all SDK libraries in the documentation section. The recommended client is written in Javascript and will be used in the examples.

npm install --save mailslurp-client

Obtain your API Key

All MailSlurp usage requires an API Key. Get your API Key free by signing up and logging into the MailSlurp dashboard.

Your API Key is shown on the Install and Settings page.

Configure your client

Next configure a MailSlurp instance with your API Key.

const { MailSlurp } = require('mailslurp-client')
const mailslurp = new MailSlurp({ apiKey: 'your-api-key' })

Create an email address in code or tests

You can now easily create email addresses.

// create a randomly assigned email address
const inbox = await mailslurp.createInbox();

You can also send emails.

mailslurp.sendEmail(inbox.id, { to: ['test@example.org'] })

And fetch emails sent to an inbox.

const email = await mailslurp.waitForLatestEmail(inbox.id, { to: ['test@example.org'] })

Next steps

See the documentation and examples for more information on getting started.


MailSlurp is free for personal use and scales with your team. Try it today.