Open-source email automation and delivery engine
Project description
๐ฌ OpenMailer
OpenMailer is a free, open-source Python email delivery framework.
Send transactional or bulk email with your own SMTP server โ Gmail, Outlook, AWS SES, Postfix, or any custom SMTP. No need for SendGrid, Mailgun, or other paid services.
๐ Why OpenMailer?
| Problem | How OpenMailer Solves It |
|---|---|
| ๐ฐ Expensive APIs | Uses your own SMTP โ no vendor fees |
| ๐ Vendor lock-in | 100% self-hosted, open-source, and extensible |
| ๐คฏ Complex APIs | Developer-first design with both CLI & Python SDK |
| ๐ No visibility | Transparent retry queue, terminal UI, logging, reports |
๐ง Key Features
- โ HTML email templating ({{name}}, {{link}}, etc.)
- โ Multi-backend SMTP routing & failover
- โ Attachments (PDFs, ZIPs, images)
- โ
Scheduled send (
--schedule) - โ
Retry queue with live retry command (
--retry) - โ
Priority queuing (
--priority) - โ Open tracking with tracking pixel
- โ Rate limiting & throttling
- โ
Local testing (
--dry-runโ saves to./outbox) - โ
CLI (
opmctl) and Python SDK - โ Bulk sending with real-time terminal table
- โ Feedback reports for bulk send
- โ Health check & analytics module
- โ Plugin-ready architecture
๐งฑ Project Structure
openmailer/
โโโ client.py # Core email client logic
โโโ smtp_engine.py # Low-level SMTP sending
โโโ template_engine.py # Jinja2-based rendering
โโโ queue_manager.py # Handles retries & delays
โโโ rate_limiter.py # Enforces send rate control
โโโ logger.py # Log storage (JSON + terminal)
โโโ secrets.py # Secure credential loading
โโโ localmode.py # --dry-run support
โโโ analytics.py # Tracks send metrics
โโโ config.py # Default + override configs
โโโ health_monitor.py # SMTP health & uptime logic
cli/
โโโ main.py # CLI entrypoint (`opmcli`)
๐ฆ Installation
git clone https://github.com/Devops-Bot-Official/OpenMailer.git
cd openmailer
python setup.py install
Then:
chmod +x cli/main.py
ln -s $(pwd)/cli/main.py /usr/local/bin/opmctl
๐ฅ๏ธ OpenMailer CLI
OpenMailer CLI (opmcli) is a full-featured command-line interface for managing email delivery using the OpenMailer engine.
โ๏ธ Single Send
opmctl --to user@example.com \
--subject "Hello {{name}}" \
--template templates/welcome.html \
--context '{"name": "Alice"}' \
--attachment invoice.pdf \
--schedule "2025-07-01 09:00" \
--priority high \
--track-open \
--report
๐ฌ Bulk Email (via CSV)
opmctl bulk --csv contacts.csv --template templates/newsletter.html --report
CSV Format:
email,subject,name,link
alice@example.com,Welcome,Alice,https://example.com/welcome
bob@example.com,News,Bob,https://example.com/update
๐งช Testing Mode
opmctl --to test@example.com --template templates/test.html --dry-run
Saves the output to ./outbox/ instead of sending real email.
๐ช CLI Options
| Flag | Description |
|---|---|
--to |
Email recipient address |
--subject |
Subject line of the email |
--template |
HTML file to use as email body |
--context |
JSON dict injected into the template ({{name}}) |
--attachment |
One or more attachments (PDF, ZIP, etc.) |
--schedule |
Future datetime for scheduled send (UTC/local) |
--priority |
Email priority: high, normal, low |
--track-open |
Add tracking pixel to monitor opens |
--dry-run |
Save email as file without actually sending |
--report |
Sends delivery report to sender |
--retry |
Retry all failed or queued emails |
bulk |
Use for bulk email campaign via CSV |
๐ Real-Time Table (Bulk Send)
During bulk send, the CLI displays a live table with email progress:
๐ฌ Bulk Email Progress
โโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโณโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโ
โ Recipient โ Subject โ Status โ Error โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ alice@example.com โ Welcome โ โ
Sent โ โ
โ bob@example.com โ Update โ โ Failed โ SMTP connect timeout โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโ
๐งโ๐ป Python SDK (Library Usage)
from openmailer import OpenMailerClient
client = OpenMailerClient()
client.send_email(
to="user@example.com",
subject="Hello {{name}}",
html_body="<h1>Hello {{name}}</h1>",
context={"name": "Bob"},
attachments=["contract.pdf"]
)
Bulk Programmatic Send
report = client.send_bulk(
recipients=["a@example.com", "b@example.com"],
subject="Notice",
html_body="<p>Hi {{name}}</p>",
context_fn=lambda to: {"name": to.split("@")[0]}
)
client.feedback_to_sender("admin@example.com", report)
๐งช Retry
Failed deliveries are automatically stored in the retry queue.
To resend:
opmctl --retry
๐ง Developer Notes
- Retry queue is file-based, future versions will support Redis or DB
- Open tracking uses an invisible pixel hit
- Supports Gmail, Outlook, AWS SES, and more (with auth configs)
- Feedback system reports how many sent/failed, per recipient
- CLI uses
richfor real-time terminal rendering - Designed to plug into CI/CD or automation pipelines
๐ก Use Cases
- Transactional messages (signup, password reset)
- System alerts and DevOps monitoring
- Custom marketing newsletters
- Embedded email engine in SaaS products
- Developer testing in local/airgapped environments
๐ฃ Roadmap
- โ Full SMTP support
- โ Retry and feedback system
- โ Bulk send and tracking
- โ Live table output for progress
- ๐ REST API server mode
- ๐ OAuth2 SMTP (Google, Outlook)
- ๐ Admin dashboard UI
- ๐ Docker image with SMTP + UI
- ๐ Plugin SDK for custom auth/rules
๐ค Contributing
We welcome contributions from Pythonistas and email nerds.
git clone https://github.com/Devops-Bot-Official/OpenMailer.git
cd openmailer
python setup.py install
Contributor Guidelines
- Engine logic goes in
openmailer/ - CLI logic lives in
cli/ - Avoid hardcoding โ use config/environment
- Document new features in README
- PRs should pass basic tests and lint
๐ License
MIT License โ use it freely in personal and commercial projects.
โค๏ธ About
OpenMailer is built by and for developers who believe in freedom, transparency, and open infrastructure. No API limits. No billing traps. Just email that works.
Made with ๐ Python. Powered by SMTP.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openmailer-0.1.13.tar.gz.
File metadata
- Download URL: openmailer-0.1.13.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74a12d7ac633f14689f9970f4384b28930e519833763bd6a96f415e96a885606
|
|
| MD5 |
1643669ed00ea2bc4d96d9e8d5e51ebb
|
|
| BLAKE2b-256 |
09fe674085e53ecc6cd0b96084d40f1d7c40fc84cbb4aa88df6aaf3568fbadc6
|
File details
Details for the file openmailer-0.1.13-py3-none-any.whl.
File metadata
- Download URL: openmailer-0.1.13-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23de10a6709cb78edc57d9f281d82a4e43bccdb309b7ffc5bd788661ae91cac8
|
|
| MD5 |
515679ed90a827ffaa71e6bb29a8f4ce
|
|
| BLAKE2b-256 |
bb4f04a4ea09ede8f81096491d7f3b8c5ad17c9fe9c4e52e88a98f5d38fa8804
|