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.
Make an address
Section titled “Make an address”POST /api/addresses
Section titled “POST /api/addresses”| Body field | Default | Meaning |
|---|---|---|
tag | A name for the group, such as the CI run id. Letters, digits and . _ : -, up to 80. | |
prefix | test | The start of the address. Letters, digits and . _ + -, up to 40. |
domain | inbox.test | The domain, such as yourcompany.test. |
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"}'The address is unique (a random part is added) and works at once. Making one needs the member role.
List and wait by tag
Section titled “List and wait by tag”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.
GET /api/messages
Section titled “GET /api/messages”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}).
| Parameter | Default | Meaning |
|---|---|---|
tag | Every address made with this tag. tag or to is required. | |
to | One or more addresses (repeated, or separated by commas), or *@domain. | |
folder | INBOX | The folder to read. |
limit | 100 | How many, at most 500. |
[ { "uid": 1, "folder": "INBOX", "flags": [], "time": "2026-10-10T14:30:00Z", "size": 4182, "subject": "Verify your email", "text": "Your verification code is 482913…" }]Clean up
Section titled “Clean up”DELETE /api/messages
Section titled “DELETE /api/messages”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.
curl -s -X DELETE "https://c1.simmail.dev/api/messages?tag=run-4821" -H "Authorization: Bearer smk_your_key"A recipe for parallel CI
Section titled “A recipe for parallel CI”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.
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});import os, re, pytestfrom 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 oneIf 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.