A lightweight Rust application that runs an SMTP server and forwards incoming emails to a configurable HTTP webhook.
Bridges the gap for software that only supports email notifications (monitoring tools, alerting systems) to modern webhook-based services like Discord, Slack, or any HTTP endpoint.
- 🚀 Lightweight SMTP server
- 🔗 Forwards emails to HTTP webhooks as JSON
- 🔄 Automatic retry logic with exponential backoff
- ⚙️ Simple TOML configuration
- 🔓 Accepts any SMTP authentication (designed for local/internal use)
- 📝 Structured logging
# Pull image from GitHub Container Registry
docker pull ghcr.io/seanmarpo/smtp2webhook:latest
# Create config file
cp config.toml.example config.toml
# Edit config.toml with your webhook URL
# Run with docker-compose
docker-compose up -d
# Or run directly
docker run -d \
--name smtp2webhook \
-p 2525:2525 \
-v $(pwd)/config.toml:/app/config.toml:ro \
ghcr.io/seanmarpo/smtp2webhook:latestPrerequisites: Rust 1.80 or higher
# Build
cargo build --release
# Configure
cp config.toml.example config.toml
# Edit config.toml with your webhook URL
# Run
cargo run --release[smtp]
bind_address = "127.0.0.1:2525" # Use "0.0.0.0:2525" for Docker
hostname = "localhost"
[webhook]
url = "http://localhost:8080/webhook"
max_retries = 3
timeout_secs = 30
# Optional: Custom headers for authentication
[webhook.headers]
Authorization = "Bearer your-token-here"
X-API-Key = "your-api-key"
[logging]
level = "info" # trace, debug, info, warn, errorEmails are sent as JSON POST requests:
{
"from": "sender@example.com",
"to": ["recipient@example.com"],
"subject": "Email Subject",
"body": "Plain text email body content",
"attachments": ["document.pdf", "image.png"]
}Content Handling:
- Plain text emails delivered as-is
- HTML emails automatically converted to plain text
- Multipart emails use plain text version
- Base64 and Quoted-Printable encodings automatically decoded
- Attachment filenames listed (content not included)
# Run Rust tests
cargo test
# Send test email
./testing/test_send_email.sh
# Test webhook receiver (separate terminal)
./testing/test_webhook.py
# Run all integration tests
./testing/run_all_tests.shPre-built images are available from GitHub Container Registry:
# Latest release
docker pull ghcr.io/seanmarpo/smtp2webhook:latest
# Specific version
docker pull ghcr.io/seanmarpo/smtp2webhook:v0.1.0Or build locally:
docker build -t smtp2webhook .- Default port: 2525
- For Docker networking, use
bind_address = "0.0.0.0:2525" - Mount config as read-only:
-v $(pwd)/config.toml:/app/config.toml:ro - Use service names in docker-compose:
http://service-name:port/webhook
- Failed webhook requests retry up to
max_retriestimes with exponential backoff - After exhausting retries, email is dropped and error logged
- SMTP server responds with success to prevent email bounces
- Accepts any SMTP authentication
- No TLS/SSL support
- Do not expose to public internet
- Use Docker networks to isolate containers
See LICENSE file for details.