# Introduction to MailSlurp

MailSlurp is an Email API built for developers and QA testers. It let's you create real email addresses on demand then send and receive emails from code, tests, or an online dashboard.

# About

This is a starter guide for developers. It uses Javascript examples to illustrate key features. You can call MailSlurp's API from any programming language. For REST API and SDKs in Ruby, Java, PHP, Python, Go, C#, Swift and more see the developer documentation.

To use MailSlurp without code try our interactive dashboard.

# Setup

MailSlurp is free for personal use but you must have an API Key to use MailSlurp. Get an API Key free by creating an account.

# Install

MailSlurp has an official Javascript client on NPM that includes Typescript types. (For REST API and SDKs in other languages see the documentation page.)

npm install --save mailslurp-client

# Import

In a NodeJS environment:

const MailSlurp = require("mailslurp-client").default;

Or with Javascript ES6 style imports (Typescript also supported):

import { MailSlurp } from "mailslurp-client";

# Configure

To configure MailSlurp you must supply an instance with you API Key.

const mailSlurp = new MailSlurp({ apiKey: "your_key_here" });

You now have a MailSlurp instance ready to use. Let's see how it works.

# Class overview

The MailSlurp instance has a number of top level convenience async functions for creating inboxes, sending emails, and receiving emails with waitFor methods. (See JS Docs for full method list)

For instance:

const inbox = await mailslurp.createInbox()

Or with promises:

mailslurp.createInbox().then(inbox => {
  // inbox = { id: '123', emailAddress: '123@mailslurp.com' }

There are many other convenience methods. The full MailSlurp API functionality is also accessible through controller properties. For example:

await mailslurp.inboxController.deleteInbox(inbox.id)

# Next steps

Now let's explore sending and receiving emails by first creating an inbox.