Bundle a Mailpit catcher and default Compose to SMTP

Adds a mailpit service (axllent/mailpit, ~15 MB, in-memory) to
docker-compose.yml — chosen over the unmaintained MailHog for the same
footprint. It has no profile, so `docker compose up -d` starts it alongside
the API; the app defaults to MAIL_TRANSPORT=smtp -> mailpit:1025 (no
auth/TLS) and mail is read at http://localhost:8025.

Also change the default MAIL_FROM to no-reply@todo.test: PHPMailer v7 rejects
the dotless no-reply@localhost as an invalid address.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 08:40:36 +01:00
co-authored by Claude Sonnet 5
parent f9b65cc4a7
commit 64ba21795b
4 changed files with 29 additions and 15 deletions
+17 -8
View File
@@ -14,21 +14,30 @@ services:
JWT_TTL: "${JWT_TTL:-86400}"
# Magic links point at the frontend dev server.
APP_URL: "${APP_URL:-http://localhost:5173}"
# The container has no MTA, so log emails to a file by default. View them with:
# docker compose exec app cat /var/www/storage/mail.log
# Set to "smtp" (with MAIL_SMTP_*) or "mail" to actually send.
MAIL_TRANSPORT: "${MAIL_TRANSPORT:-log}"
MAIL_FROM: "${MAIL_FROM:-no-reply@localhost}"
MAIL_SMTP_HOST: "${MAIL_SMTP_HOST:-}"
MAIL_SMTP_PORT: "${MAIL_SMTP_PORT:-587}"
# Deliver to the Mailpit catcher below; read mail at http://localhost:8025.
MAIL_TRANSPORT: "${MAIL_TRANSPORT:-smtp}"
MAIL_FROM: "${MAIL_FROM:-no-reply@todo.test}"
MAIL_SMTP_HOST: "${MAIL_SMTP_HOST:-mailpit}"
MAIL_SMTP_PORT: "${MAIL_SMTP_PORT:-1025}"
MAIL_SMTP_USERNAME: "${MAIL_SMTP_USERNAME:-}"
MAIL_SMTP_PASSWORD: "${MAIL_SMTP_PASSWORD:-}"
MAIL_SMTP_ENCRYPTION: "${MAIL_SMTP_ENCRYPTION:-tls}"
MAIL_SMTP_ENCRYPTION: "${MAIL_SMTP_ENCRYPTION:-none}"
volumes:
# Live source: edit on the host, no image rebuild needed.
- .:/var/www/html
# Persistent storage, kept outside /var/www/html to avoid a nested mount.
- storage:/var/www/storage
depends_on:
- mailpit
restart: unless-stopped
# Development mail catcher (Mailpit — the maintained MailHog successor). ~15 MB,
# single Go binary, messages held in memory. Web UI: http://localhost:8025
mailpit:
image: axllent/mailpit:v1.31
ports:
- "8025:8025" # web UI + REST API
- "1025:1025" # SMTP (also reachable in-network as mailpit:1025)
restart: unless-stopped
# Optional Vite dev server. Start it with: docker compose --profile frontend up -d