MailHits is a lightweight email testing tool that provides a simple SMTP server and web interface for capturing and viewing emails during development and testing.
- SMTP Server: Captures emails sent to any address on the configured port
- Web Interface: View captured emails in real-time
- Email Parsing: Parses email content including headers, text and HTML bodies
- WebSocket Support: Real-time updates when new emails arrive
- Multiple View Formats: View emails in HTML, plain text, or raw header format
- No Configuration Needed: Works out of the box with sensible defaults
- Rust (1.70.0 or later)
-
Clone the repository:
git clone https://github.com/fwhy/MailHits.git cd MailHits
-
Build the project:
cargo build --release
-
The compiled binary will be available at
target/release/mailhits
Run MailHits with default settings:
./mailhits
This will start:
- SMTP server on port 1025
- Web interface on port 3000
./mailhits --help
Available options:
-s, --smtp-port <PORT>
: Set the SMTP server port (default: 1025)-p, --http-port <PORT>
: Set the HTTP server port (default: 3000)
Configure your application to send emails to:
- SMTP server:
localhost
- Port:
1025
(or your custom port)
No authentication is required.
- Open your web browser and navigate to
http://localhost:3000
- Send an email through your application
- The email will appear in the MailHits web interface in real-time
MailHits is built with:
- Tokio for async runtime
- Axum for the web server
- mail-parser for email parsing
MailHits includes a comprehensive test suite:
cargo test
- Unit Tests: Located within each module file (models.rs, smtp.rs, http.rs)
- Test individual components in isolation
- Verify correct behavior of email parsing, HTTP endpoints, etc.
The test suite covers:
- Email data structure creation and validation
- SMTP email processing
- HTTP API endpoints (get emails, get single email, delete emails)
This project is open source and available under the MIT License.