MailDev
What is MailDev?
MailDev is a simple SMTP testing tool: it catches outgoing dev email and shows it in a web UI instead of delivering it, similar in purpose to Mailpit and MailHog. Laradock builds it as its own container from the official maildev/maildev image.
Start MailDev
- Laradock CLI
- Docker Compose
./laradock start maildev
docker compose up -d maildev
MailDev keeps no volume on disk, everything it catches lives in the container's memory only. That's fine for day-to-day dev testing, just know that stopping or removing the container discards every captured email (see Clear captured mail below if you want to do that on purpose without restarting).
Stop MailDev
Stopping just pauses the container:
- Laradock CLI
- Docker Compose
./laradock stop maildev
docker compose stop maildev
To remove the container:
- Laradock CLI
- Docker Compose
./laradock remove maildev
docker compose rm -sf maildev
Since MailDev has no data volume, stopping or removing it has the same practical effect either way: whatever mail was captured is gone once the container isn't running.
Configuration
All settings live in maildev/defaults.env and can be overridden by adding the same line to your own .env:
| Variable | Default | What it does |
|---|---|---|
MAILDEV_HTTP_PORT | 1080 | Host-side port for the web UI (container port 1080). |
MAILDEV_SMTP_PORT | 25 | Host-side port for the SMTP catcher (container port 25). |
Connect your app
Open the web UI at http://localhost:1080. Point your app's SMTP settings at the maildev container name (not localhost) on its internal SMTP port:
MAIL_MAILER=smtp
MAIL_HOST=maildev
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
Clear captured mail
MailDev has no "delete all" data-wipe step the way a database would, since it never writes to disk. To clear what's currently showing in the web UI:
- From the UI: open http://localhost:1080 and use the trash/delete-all icon in the toolbar to clear every captured message, or delete individual messages from their row.
- From the REST API: MailDev exposes a small HTTP API on the same port as the web UI. To delete everything:
curl -X DELETE http://localhost:1080/email/all
Restarting or removing the container achieves the same result, since nothing is persisted between runs anyway.
Common issues
- Mail isn't showing up in the UI. Confirm your app's
.envusesMAIL_HOST=maildev(the container name), notlocalhostor127.0.0.1, those only resolve from your host machine, not from inside another container. - Port
25conflicts on your host. Port 25 is often reserved or blocked by ISPs/host mail agents. ChangeMAILDEV_SMTP_PORTin.envand restart:./laradock restart maildev. - Port already in use for the web UI. Change
MAILDEV_HTTP_PORTin.envand restart:./laradock restart maildev. - Captured mail disappeared. Expected if the container was stopped, removed, or restarted, MailDev keeps everything in memory only, there's no volume backing it.
Prefer a more actively maintained, Go-based catcher? See Mailpit. New to Laradock? Start with Getting Started.