Recipes

Mailpit

Local SMTP catcher for channel.email — SMTP_URL on :1025, UI on :8025, MAILPIT_UI_URL.

Mailpit is the oke dev email catcher — every message the smtp channel driver sends lands in a web UI instead of a real inbox. Pin it as images.channel.email when drivers.channel.email.dev is smtp.

The one rule

devprod for the SMTP protocol — same SMTP_URL shape. Mailpit is not a production MTA; swap the image / URL for a real relay in production.

Quick start

Pin the image (templates already do)

oke.config.ts
drivers: {
  channel: {
    email: { dev: "smtp", test: "console", prod: "smtp" },
  },
},
images: {
  channel: { email: "axllent/mailpit:v1.31.1" },
},

Connect the smtp driver

.env.local (written by oke docker)
SMTP_URL=smtp://127.0.0.1:1025
MAILPIT_UI_URL=http://127.0.0.1:8025

No SMTP_USER / SMTP_PASSWORD required for Mailpit's open local listener.

Send and inspect

Trigger any flow that uses fx.email / channel email. Open MAILPIT_UI_URL (port 8025) to read the caught message — subject, body, headers.

Required env

VariableRequired?Meaning
SMTP_URLYes (app, smtp driver)smtp://host:1025 — boot fails without it
OKE_CHANNEL_EMAIL_URLAlternativeSame role as SMTP_URL
MAILPIT_UI_URLWritten by stackBrowser UI — not read by the smtp driver
SMTP_USER / SMTP_PASSWORDNo for MailpitUsed when pointing SMTP_URL at an authenticated relay

Data and backup

Mailpit declares no volume. Caught messages live in container memory/disk for that instance only.

Backup means: nothing durable to back up — this is a catcher. For forensic copies, export from the UI before recreate. Production mail never uses this image as the store of record.

Production note

Templates set prod: "smtp" but still pin Mailpit in images for docker. In real prod, point SMTP_URL at your provider and set SMTP_USER / SMTP_PASSWORD as needed.

Leaving Mailpit reachable on a public host exposes an open relay UI — bind to the compose network only.

Healthcheck probes http://127.0.0.1:8025/api/v1/info — UI down ⇒ service unhealthy even if SMTP still accepts mail.

What the recipe configures

FieldValue
SMTP port1025 (published)
Extra port8025 → UI
Healthcheckwget against /api/v1/info, every 5s, 10 retries
Connection URLsmtp://host:1025

Troubleshooting

Learn more

Next

On this page