Javascript email libraries for MailSlurp

Send and receive email from real email addresses using NodeJS, JS, or Typescript. Official MailSlurp SDKs published to NPM that let you generate test email accounts for tests or code and send and receive emails and attachments.

Test applications end-to-end using real emails with Jest, CypressJS, WebDriver and more. A powerful alternative to NodeMailer and SMTP mail servers, MailSlurp is a REST based API with official Javascript wrappers including Typescript support.

Code samples

Language
Example
// install package with `npm install --save mailslurp-client`
import { MailSlurp } from "mailslurp-client"

// instantiate a client with API KEY
const mailslurp = new MailSlurp({ apiKey: 'your-api-key' })

// create an inbox with a random email address ending in @mailslurp.com
const { emailAddress, id } = await mailslurp.createInbox()
expect(emailAddress).toContain("@mailslurp.com")

// for full control over inbox email addresses use a custom domain
const customInbox = await mailslurp.createInbox("test@mydomain.com")

Get started

Tags