Email code examples

See MailSlurp in action with code examples or interactive demo app.

Please see for code examples in several languages.


Getting started with MailSlurp

The quickest way to start using MailSlurp is to sign up for an account and create an inbox. Then configure an SMTP client to use your SMTP username and password with the standard MailSlurp SMTP server host at

Using SDK clients

MailSlurp offers many SDK libraries for developers. The recommended client is the NPM javascript library.

npm install --save mailslurp-client

Then configure the client like so:

import { MailSlurp } from "mailslurp-client";
const mailslurp = new MailSlurp({ apiKey: process.env.API_KEY })

Then create a real email address using the createInbox method.

const inbox = await mailslurp.createInbox();

Ready to dive in?Start building email applications today.