DEV Community

sms-florin
sms-florin

Posted on

Replacing Mailinator in your CI tests: private inboxes, no signup

Mailinator is great for eyeballing one email. In automated tests it has two problems: the free inboxes are public, and API access needs a paid plan or approval. If your test reads a verification code from a public inbox, anyone who guesses the address can read it, or land on the same inbox as your test.

What I use instead is receivemail.dev: one request creates a random address plus a secret, and only the secret can read the mail. No signup, no key.

import { test, expect } from "playwright-receivemail";

test("new user verifies their email", async ({ page, mailbox }) => {
  await page.goto("/signup");
  await page.getByLabel("Email").fill(mailbox.address);
  await page.getByRole("button", { name: "Create account" }).click();
  const code = await mailbox.waitForMatch(/\b\d{6}\b/);
  await page.getByLabel("Verification code").fill(code);
});
Enter fullscreen mode Exit fullscreen mode

Tradeoffs: messages live 60 minutes on the free tier, there is no custom domain, and it's email only. Side-by-side with Mailinator, Mailosaur and others: https://receivemail.dev/compare/mailinator-alternative

I built it, so weigh that accordingly.

Top comments (0)