This guide gets you from zero to a working send-and-receive workflow quickly.
Quickstart path
- Install an SDK.
- Add your API key via environment variable.
- Create an inbox.
- Send a message.
- Wait for and assert the received message.
1) Install an SDK
JavaScript client:
npm install --save mailslurp-client
Other official SDKs: docs.mailslurp.com.
2) Configure your API key
Create a key in the dashboard and inject it into your environment:
export MAILSLURP_API_KEY="your-key"
API-key setup details: API key guide.
3) Create a MailSlurp client
import { MailSlurp } from "mailslurp-client";
const mailslurp = new MailSlurp({
apiKey: process.env.MAILSLURP_API_KEY,
});
4) Create an inbox and send a test message
const inbox = await mailslurp.createInbox();
await mailslurp.sendEmail(inbox.id, {
to: [inbox.emailAddress],
subject: "Quickstart check",
body: "Hello from MailSlurp",
});
5) Wait for delivery and assert content
const email = await mailslurp.waitForLatestEmail(inbox.id, 30_000, true);
if (!email.subject?.includes("Quickstart check")) {
throw new Error("Unexpected subject");
}
What to implement next
- signup/magic-link tests
- OTP or reset-code extraction
- inbound webhook processing
- attachment verification
Use these routes next:
