Email in code examples

See MailSlurp in action with code examples or interactive demo app. Use C#, Java, PHP, Javascript and more to control email addreses.

  • Table of contents

Please see github.com/mailslurp/examples for code examples in several languages.

ui

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 mx.mailslurp.com:2525.

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();
console.log(inbox);
Email and SMS Platform
Create a free account in 3 clicks