Getting started
Installation
Section titled “Installation”Mailsink ships as one Docker image, ghcr.io/devitek/mailsink (linux/amd64 and
linux/arm64): HTTP on port 3000 (web UI, provider APIs, Capture API, MCP, /healthz)
and SMTP on port 1025. Storage is embedded PGlite by default, PostgreSQL as an option.
Docker with Compose v2 is the only requirement.
curl -fsSLO \ https://raw.githubusercontent.com/Devitek/mailsink/main/docker/docker-compose.ymlexport MAILSINK_ADMIN_KEY=change-me # unset, the Admin API and the web UI refuse access
# Embedded PGlite, data in the `pglite-data` volumedocker compose --profile pglite up -d
# Or PostgreSQL 18, data in the `postgres-data` volumedocker compose --profile postgres up -d
curl http://localhost:3000/healthz # {"status":"ok",...} once the container is healthyThe Compose file runs ghcr.io/devitek/mailsink:latest; set MAILSINK_IMAGE to pin a
release (ghcr.io/devitek/mailsink:0.1 or :0.1.0). Host ports are set with
MAILSINK_HTTP_PORT and MAILSINK_SMTP_HOST_PORT, the Postgres password with
POSTGRES_PASSWORD. Migrations run at every boot; the first boot on an empty PGlite volume
takes about 10 seconds. The mailsink CLI is in the image, for example
docker compose --profile postgres exec mailsink-postgres mailsink migrate.
STARTTLS on SMTP is optional: put the PEM certificate and key in a host directory readable
by uid 1001, then set MAILSINK_SMTP_TLS_DIR (mounted read-only on /app/tls, relative
to the Compose file), MAILSINK_SMTP_TLS_CERT=/app/tls/cert.pem and
MAILSINK_SMTP_TLS_KEY=/app/tls/key.pem.
Without Compose
docker run -d -p 3000:3000 -p 1025:1025 -v mailsink-data:/app/data \ -e MAILSINK_ADMIN_KEY=change-me ghcr.io/devitek/mailsink:latestThe container runs as an unprivileged user (uid 1001): a bind mount used as /app/data
must be writable by that uid.
From a clone, to run your own build:
git clone https://github.com/Devitek/mailsink.git && cd mailsinkMAILSINK_IMAGE=mailsink:local docker compose -f docker/docker-compose.yml \ --profile pglite up -d --buildOpen http://localhost:3000 and sign in with the admin key to browse workspaces, rendered emails and logs. Tests and CI drive the same data over HTTP.
Provision an ephemeral workspace for a CI run
curl -X POST http://localhost:3000/admin/workspaces \ -H "Authorization: Bearer $MAILSINK_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"ci-42","ephemeral":true,"connections":[{"kind":"resend","name":"app"}]}'The response holds the secrets once: workspaceKey (mskw_…, for the Capture API) and,
per connection, its credentials and an .env snippet.
Send with the Resend SDK, unchanged
RESEND_API_KEY=msk_… # connections[0].credentials.apiKeyRESEND_BASE_URL=http://localhost:3000 # read by the SDKimport { Resend } from 'resend'
const resend = new Resend(process.env.RESEND_API_KEY)await resend.emails.send({ from: 'Acme <hello@app.test>', to: 'jane@example.com', subject: 'Welcome', html: '<p>Hi</p>',})Brevo connections work the same way with the Brevo SDK, smtp connections with any SMTP
client such as Nodemailer on port 1025.
Wait for the email in a test
since=$(date -u +%Y-%m-%dT%H:%M:%SZ) # taken before the app sends# ...the app sends the emailcurl -G http://localhost:3000/capture/messages \ -H "Authorization: Bearer $MAILSINK_WORKSPACE_KEY" \ -d to=jane@example.com -d since="$since" -d wait=true -d timeout=10000The call answers as soon as a message matches, or 408 after the timeout. The
E2E testing guide gives the full recipe: one ephemeral workspace per
test worker, reset between tests, forced bounces through overrides. The
MCP guide connects Claude Code, Claude Desktop or Cursor to a
workspace.
npm packages
Section titled “npm packages”Test tooling for Node, published under the @devitek scope with the version of the
server (SDK x.y.z matches server x.y.z):
| Package | What it does | Guide |
|---|---|---|
@devitek/mailsink |
TypeScript SDK: workspaces, waitFor, links and codes, overrides, webhooks, live stream |
SDK guide |
@devitek/mailsink-playwright |
Playwright fixtures: one ephemeral workspace per worker | E2E guide |
@devitek/mailsink-vitest |
Vitest and Jest helpers and matchers | Vitest and Jest guide |
@devitek/mailsink-cli |
mailsink command for CI scripts and the MCP stdio proxy |
CLI guide |
npm install --save-dev @devitek/mailsinkOther languages generate a client from the OpenAPI 3.1 document: GET /openapi.json on
any instance, or the openapi.json attached to each
GitHub release (see the
HTTP API guide).
Features
Section titled “Features”- Workspaces: persistent for staging, ephemeral with an idle TTL for CI.
- Connections per workspace:
resend,brevo,smtp, each with its own credentials. - Simulation: status rates, deterministic per-recipient rules, latency, chaos errors, rate limits, temporary overrides with reset, automatic suppression list.
- Webhooks signed with HMAC-SHA256 and Svix-compatible headers, retries and replay.
- Capture API, SSE stream and an MCP server for AI agents (HTTP and stdio, see the MCP guide).
- Web UI in English and French.