Mailpit role
Deploy Mailpit, a lightweight SMTP server and email testing tool with web UI for development and testing environments.
Usage
Configure registry credentials in your inventory:
1 2 3 | |
Include the role in your playbook:
1 2 3 4 | |
The role provides these tags:
- mailpit-install - Deploy Mailpit container
- mailpit-uninstall - Remove Mailpit container
Docs
Deploy Mailpit to your Docker host:
1 | |
Remove Mailpit installation:
1 | |
Configuration Details
The role deploys Mailpit with:
- Custom Image: gitea.rwcloud.ch/official-docker-images/axllent/mailpit:latest
- Traefik Integration: Automatic HTTPS for web UI via Traefik
- SMTP Port: 1025 (exposed for applications to send email)
- Web UI Port: 8025 (internal, accessed via Traefik)
- Persistent Storage: SQLite database for email storage
- Network: Connects to external proxy network
Accessing Mailpit
After deployment:
- Web UI: https://mailpit.rwcloud.ch
- SMTP Server: mailpit.rwcloud.ch:1025
SMTP Configuration
Configure your applications to send email via Mailpit:
1 2 3 4 | |
Example for Gitea:
1 2 3 4 5 6 | |
Environment Variables
The container is configured with:
- MP_MAX_MESSAGES=5000 - Maximum stored messages
- MP_DATABASE=/data/mailpit.db - SQLite database location
- MP_SMTP_AUTH_ACCEPT_ANY=1 - Accept any authentication
- MP_SMTP_AUTH_ALLOW_INSECURE=1 - Allow insecure connections
Storage
One volume is created:
- mailpit - Contains SQLite database with stored emails
Features
Mailpit provides: - Web-based email viewing interface - Search functionality across all emails - HTML and plain text email rendering - Attachment downloads - Real-time email arrival notifications - API for automation and testing - Tag filtering - Message release (forward to real SMTP) - Spam score display
Use Cases
Perfect for: - Development environment email testing - CI/CD pipeline email verification - QA testing of email notifications - Viewing outbound emails from applications - Debugging email templates - Testing email integrations
Web Interface Features
The web UI shows: - Email list with sender, subject, date - Full email preview (HTML/text) - Email headers and metadata - Attachments with download links - Search across all fields - Auto-refresh for new messages
Database
Emails are stored in a SQLite database (mailpit.db). The database is limited to 5000 messages (configurable via MP_MAX_MESSAGES). Older messages are automatically pruned.
Security Note
Mailpit is designed for testing/development: - No authentication on SMTP port - Accepts all messages - Not suitable for production email handling - Should not be exposed to untrusted networks
