Spring Boot mail to a local inbox, two properties
To test Spring Boot mail without sending it, set two properties: spring.mail.host and spring.mail.port=1025, pointed at Buggregator. Every email your app sends with JavaMailSender then lands in a local inbox, with the HTML preview, the attachments and the raw source. Nothing reaches a real address.
Steps
1. Start Buggregator
Run the container. Port 8000 is the web UI, port 1025 is the SMTP server.
docker run --pull always \
-p 127.0.0.1:8000:8000 \
-p 127.0.0.1:1025:1025 \
-p 127.0.0.1:9912:9912 \
-p 127.0.0.1:9913:9913 \
ghcr.io/buggregator/server:latest2. Set the mail properties in a local profile
Put them in a profile file such as application-local.properties, so they never reach production. No user, password or TLS is needed.
spring.mail.host=127.0.0.1
spring.mail.port=1025Your app needs spring-boot-starter-mail on the classpath. Spring Boot creates the JavaMailSender bean once spring.mail.host is set.
3. Use the service name in Docker Compose
If your app runs in the same Compose stack as Buggregator, use the service name as the host.
spring.mail.host=buggregator
spring.mail.port=10254. Send an email and open it
Run the app with the local profile and trigger any email. Open http://127.0.0.1:8000. You see the rendered HTML, the plain text version, the addresses, the attachments and the raw MIME source.
Why it works
Buggregator includes a fake SMTP server on port 1025. JavaMailSender delivers to it like to any mail server, and Buggregator stores the email and shows it in the UI instead of sending it on. Your mail code does not change, only two properties in a local profile.
Related tips
- Sentry
Spring Boot errors through the Sentry Java SDK, locally
Add the Sentry Spring Boot starter and point sentry.dsn at Buggregator. Exceptions, traces and logs of your app show up on your machine.
- Mail
Catch dev email in docker-compose with one service
Add Buggregator as a service in docker-compose.yml and set your app's mail host to its service name. Every email lands in the UI on port 8000.
- Mail
Django emails in a local inbox, not the console
Use Django's SMTP email backend with host 127.0.0.1 and port 1025. Every email lands in Buggregator with HTML, headers and attachments.
- Mail
Wait for the confirmation email in an E2E test
Call /api/smtp/messages/wait from your E2E test. It returns the matching email as soon as it arrives, or 408 on timeout. No fixed sleeps.
Checked on with Buggregator v2.13.0