Catch dev email in docker-compose with one service
Need an SMTP server in Docker for development? Add Buggregator as one more service in your docker-compose.yml, then set your app's mail host to buggregator and the port to 1025. Every email your app sends shows up in the Buggregator UI on port 8000 instead of a real inbox.
Steps
1. Add the service
Put Buggregator in your docker-compose.yml next to your other services. No environment configuration is needed.
services:
buggregator:
image: ghcr.io/buggregator/server:latest
ports:
- 127.0.0.1:8000:8000
- 127.0.0.1:1025:1025
- 127.0.0.1:9912:9912
- 127.0.0.1:9913:9913You only need to expose the ports for the features you use. Port 8000 is the web UI and the only required port. Port 1025 is the SMTP server. The 127.0.0.1: prefix keeps each port on your machine.
2. Point your app at the service name
Other services in the same Compose stack reach Buggregator by its service name. For a Laravel app, change these lines in .env:
# SMTP — email capture
MAIL_HOST=buggregator
MAIL_PORT=1025Other frameworks follow the same rule: wherever their docs say 127.0.0.1, use buggregator. For Symfony that means MAILER_DSN=smtp://buggregator:1025. No authentication is required.
3. Send an email and open the UI
Trigger any email from your app, then open http://127.0.0.1:8000. The email appears with the HTML preview, plain text, addresses, attachments and raw source.
Why it works
Buggregator includes a fake SMTP server on port 1025 that stores each email instead of delivering it. Inside one Compose stack, the service name resolves to the Buggregator container, so changing the host is the only change your app needs.
Related tips
- Mail
Laravel mail to a local inbox, three .env lines
Set MAIL_MAILER, MAIL_HOST and MAIL_PORT in .env and every Laravel email lands in Buggregator with HTML preview and attachments. Nothing is delivered.
- Mail
Symfony Mailer to a local inbox, one line
Set MAILER_DSN=smtp://127.0.0.1:1025 in your .env and every Symfony email lands in Buggregator with HTML preview and raw source.
- Mail
Nodemailer to a local inbox, no real email sent
Create a Nodemailer SMTP transport for 127.0.0.1:1025 and every message lands in Buggregator with HTML preview and attachments. Nothing is delivered.
- Mail
Check an HTML email at phone width before it ships
Send your app's email to Buggregator on port 1025, then switch the HTML preview between Desktop, Tablet and Mobile width. Nothing reaches a real inbox.
Checked on with Buggregator v2.8.0