Skip to main content

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

openmailer-0.1.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

openmailer-0.1.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file openmailer-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for openmailer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aa085d8d2804628440432c2446a51c9aed168ef5a8a67e2ea8010cf93647df21
MD5 156e54640e4eb6acf1136fa12fd85e31
BLAKE2b-256 dcdf60bf2fcd6b6e02457a9529cfdc530694e0a001ba5a8eb599c6deb2d12ed3

See more details on using hashes here.

File details

Details for the file openmailer-0.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for openmailer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c259ab1d2d751d413605b26ce31889b5f3a24399940b3da3b71c560b3903cb20
MD5 aa94b4fa4de11fb946a30e6b54bf0f1d
BLAKE2b-256 e0a6db37cb372ac508c594419b530da995ee98e2f2e14f2485fda9714e518dd1

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