Skip to content

Test addresses and parallel runs

When several tests (or several CI runs) share one universe, the hard part is keeping their email apart. simmail gives each test a fresh address on request, groups addresses with a tag, and lets you wait on, list and delete mail by that tag.

A test address is a real mailbox in your universe: mail your app sends to it is delivered and kept, nobody plays it, and no stranger is put behind it, so it never replies and costs no people or AI actions.

Body fieldDefaultMeaning
tagA name for the group, such as the CI run id. Letters, digits and . _ : -, up to 80.
prefixtestThe start of the address. Letters, digits and . _ + -, up to 40.
domaininbox.testThe domain, such as yourcompany.test.
Terminal window
curl -s -X POST https://c1.simmail.dev/api/addresses \
-H "Authorization: Bearer smk_your_key" -H "Content-Type: application/json" \
-d '{"tag": "run-4821", "prefix": "signup"}'
{ "address": "[email protected]", "tag": "run-4821" }

The address is unique (a random part is added) and works at once. Making one needs the member role.

GET /api/wait and GET /api/wait/none take tag= instead of (or as well as) to=: they watch every address made with that tag, including ones made while the wait runs. See the wait API.

Every message in the selected mailboxes, newest first, with the text cut short (read one in full with GET /api/mailboxes/{address}/messages/{folder}/{uid}).

ParameterDefaultMeaning
tagEvery address made with this tag. tag or to is required.
toOne or more addresses (repeated, or separated by commas), or *@domain.
folderINBOXThe folder to read.
limit100How many, at most 500.
[
{
"address": "[email protected]",
"uid": 1,
"folder": "INBOX",
"flags": [],
"time": "2026-10-10T14:30:00Z",
"size": 4182,
"message_id": "<[email protected]>",
"from": "[email protected]",
"subject": "Verify your email",
"text": "Your verification code is 482913…"
}
]

Deletes the mail in the selected mailboxes (every folder, or only folder=) and answers how many messages went: {"deleted": 12, "addresses": ["[email protected]", "…"]}. It takes tag or to, like GET /api/messages, and needs the member role. A mail.deleted event records it.

Terminal window
curl -s -X DELETE "https://c1.simmail.dev/api/messages?tag=run-4821" -H "Authorization: Bearer smk_your_key"

Give every run a tag (the CI run id), make each test’s addresses with it, and clean up at the end. Runs never see each other’s mail, and a test can wait on the whole run’s mail at once.

JavaScript (Playwright)
import { test, expect } from "@playwright/test";
import { Simmail } from "@plexuslabs/simmail";
const mail = new Simmail();
const run = mail.tag(`ci-${process.env.GITHUB_RUN_ID ?? Date.now()}`);
test.afterAll(async () => { await run.cleanup(); });
test("sign-up sends one verification email", async ({ page }) => {
const addr = await run.newAddress({ prefix: "signup" });
await page.goto("/signup");
await page.fill("#email", addr.address);
const waiting = addr.waitForEmail({ subjectRegex: /verify/i, timeout: "20s" });
await page.click("text=Create account");
const msg = await waiting;
await page.fill("#code", msg.codes[0]);
await addr.expectNoEmail({ subject: "verify", within: "5s" }); // and only one
});
Python (pytest)
import os, re, pytest
from simmail import Simmail
mail = Simmail()
run = mail.tag(f"ci-{os.environ.get('GITHUB_RUN_ID', 'local')}")
@pytest.fixture(scope="session", autouse=True)
def clean_up():
yield
run.cleanup()
def test_signup_sends_one_verification_email(client):
addr = run.new_address(prefix="signup")
client.post("/signup", data={"email": addr.address, "password": "pw-123456789"})
msg = addr.wait_for_email(subject_regex=re.compile("verify", re.I), timeout=20)
assert msg.codes
addr.expect_no_email(subject="verify", within=5) # and only one

If your app’s own test domain matters (say it only accepts @yourcompany.test), pass domain when you make the address. See also CI with GitHub Actions.