cookbook / mailpit
Mailpit
Catches outgoing email for tests, with a web inbox and a JSON API.
- testing
Run it
briq_run({
recipe: "mailpit",
params: {
"size": "nano"
},
wait: true
})briq run mailpit
briq ls
briq logs -f <id>
briq rm <id>import { Briq } from '@briq/sdk';
const briq = new Briq(process.env.BRIQ_API_KEY);
const mailpit = await briq.run({
recipe: 'mailpit',
params: {
"size": "nano"
},
});
console.log(mailpit.outputs.SMTP_HOST);
// ... when done
await briq.destroy(mailpit.id);Parameters
| Name | Type | Options | Default |
|---|---|---|---|
| size | enum | nano, small | "nano" |
Outputs
Returned by briq_run once the stack is healthy. Hosts resolve inside your team network; secrets are generated per run.
- SMTP_HOST
- mailpit.<stack>.internal
- SMTP_PORT
- 1025
- SMTP_URL
- smtp://mailpit.<stack>.internal:1025
- MAILPIT_UI
- http://mailpit.<stack>.internal:8025
- MAILPIT_API
- http://mailpit.<stack>.internal:8025/api/v1/messages
What it runs
| Briq | Image | Ports | Size | Volume |
|---|---|---|---|---|
| mailpit | axllent/mailpit:latest | 1025, 8025 | nano | — |
When to use it
- Your application sends email and the test suite must assert on what was sent: recipients, subject, HTML body, attachments.
- You want to see the emails a flow produces without sending anything real.
Point the application at SMTP_HOST/SMTP_PORT (no auth, no TLS). Every message lands in the inbox and is readable through the JSON API.
Tips
- Assert through the API.
briq_execwithwget -qO- "$MAILPIT_API?query=to:alice@example.com"returns JSON; or read a message body at/api/v1/message/<id>. - Clear between tests with a
DELETEon/api/v1/messages. - Show it to a human.
briq_exposeport 8025 withmode: "token"gives a browsable inbox. - It is tiny.
nanois the default size and enough for thousands of messages.