Skip to main content

A pure Python open-source email delivery tool

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 rich for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openmailercli-0.1.2.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openmailercli-0.1.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file openmailercli-0.1.2.tar.gz.

File metadata

  • Download URL: openmailercli-0.1.2.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for openmailercli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 11fa0c949a581c5a968b106f3b76438d667a5e795c022e77ed4a5d66a7e8e6fe
MD5 3f63bcf206cbbb974fb1592d42170d60
BLAKE2b-256 28a2106e0792dedb3b6b5bbaa5dd3c614bdfba3c9f5648e127d7a8f7ff047a5a

See more details on using hashes here.

File details

Details for the file openmailercli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: openmailercli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for openmailercli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ecbf231d5fad23cb917d3a1e3c12ab1fc84597f0d44f1fa369af63462fdb8414
MD5 58cc462a34cdeb69b314bddfc8c40020
BLAKE2b-256 878379c10901494036424e56eddcd8be9b951934b361692a9a64848387bb9b38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page