Mailpit
What is Mailpit?
Mailpit is a modern, fast, Go-based SMTP testing tool. It runs a fake SMTP server that catches every email your app sends and shows them in a web UI, instead of actually delivering them. Laradock builds it as its own container so you never accidentally send real email from a dev environment.
Start Mailpit
docker compose up -d mailpit
Stop Mailpit
docker compose stop mailpit
This stops the container without deleting its data. To remove the container: docker compose rm -f mailpit.
Configuration
All settings live in mailpit/defaults.env and can be overridden by adding the same line to your own .env:
| Variable | Default | What it does |
|---|---|---|
MAILPIT_HTTP_PORT | 8125 | Host-side port for the web UI (container port 8025). |
MAILPIT_SMTP_PORT | 1125 | Host-side port for the SMTP catcher (container port 1025). |
Connect your app
Open the web UI at http://localhost:8125 to see caught mail. Point your app's SMTP settings at the mailpit container name (not localhost) on its internal port 1025:
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1125
MAIL_USERNAME=null
MAIL_PASSWORD=null
Common issues
- Mail isn't showing up in the UI. Confirm your app's
.envusesMAIL_HOST=mailpit(the container name), notlocalhostor127.0.0.1, those only resolve from your host machine, not from inside another container likeworkspaceorphp-fpm. - Port already in use on your host. Change
MAILPIT_HTTP_PORT(and/orMAILPIT_SMTP_PORT) in.envand restart:docker compose up -d mailpit. - Confusing the two ports.
MAILPIT_SMTP_PORT(1125by default) is what your app sends mail to;MAILPIT_HTTP_PORT(8125) is where you view it in a browser. They're not interchangeable.
Looking for the older Go-based tool Mailpit replaced? See MailHog. Need a full mail server instead of a dev catcher? See Mailu. New to Laradock? Start with Getting Started.