# Mailpit recipe

URL: https://briq.cloud/cookbook/mailpit

> Catches outgoing email for tests, with a web inbox and a JSON API.

Tags: email, testing

## Run it

MCP:

```ts
briq_run({
  recipe: "mailpit",
  params: {
    "size": "nano"
  },
  wait: true
})
```

REST:

```bash
curl -X POST https://api.briq.cloud/v1/briqs \
  -H "Authorization: Bearer $BRIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recipe": "mailpit",
    "params": {
      "size": "nano"
    },
    "wait": true
  }'
# → { "briqs": [{ "id": "bq_…", … }], "outputs": { "SMTP_HOST": "…" }, … }

# ... when done, for each briq id
curl -X DELETE https://api.briq.cloud/v1/briqs/<id> \
  -H "Authorization: Bearer $BRIQ_API_KEY"
```

## Parameters

| Name | Type | Options | Default | What it does |
| --- | --- | --- | --- | --- |
| `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.

| Output | Value |
| --- | --- |
| `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 tests must assert on the emails your app sends: recipients, subject, body, attachments.
* You want to see what a flow sends without sending anything real.

Point the app at `SMTP_HOST`/`SMTP_PORT` (no auth, no TLS).

## Tips

* **Assert through the API** at `MAILPIT_API`: search with
  `/api/v1/search?query=to:alice@example.com`, read one message at `/api/v1/message/<id>`.
* **Clear between tests**: `DELETE` on `MAILPIT_API`.
* **Inbox for a human**: `briq_run({ recipe: "mailpit", expose: "private" })`.
