Skip to main content

OpenMail

OpenMail is a lightweight, extensible Python toolkit for working with email systems using IMAP (reading, searching, triage) and SMTP (sending and composing), with optional LLM-powered assistance for summarization, replies, prioritization, and intelligent search.

The package is designed with a clean separation of concerns:

  • Transport: IMAP and SMTP clients
  • Coordination: a single high-level manager
  • Query building: fluent, lazy IMAP queries
  • Intelligence: optional LLM-based workflows

OpenMail is suitable for building inbox tools, assistants, dashboards, CRMs, helpdesks, or personal productivity systems.


📦 Installation

pip install openmail

🧱 Package Architecture

OpenMail exposes three main high-level components:

Component Purpose
EmailManager Coordinates IMAP & SMTP for sending, fetching, replying, forwarding, and mailbox operations
EmailQuery Fluent, lazy IMAP query builder
EmailAssistant Optional LLM-powered assistant for summarization, replies, search, and analysis

Each component is documented in detail in its own markdown file.
This document only provides a high-level overview and initialization examples.


🔌 EmailManager

EmailManager is the central orchestration layer.
It combines an IMAP client and an SMTP client into a single, consistent API.

Basic Initialization

from openmail.smtp import SMTPClient
from openmail.imap import IMAPClient
from openmail.auth import PasswordAuth
from openmail import EmailManager

auth = PasswordAuth(
    username="you@example.com",
    password="app_password",
)

imap = IMAPClient(
    host="imap.example.com",
    port=993,
    auth=auth,
)

smtp = SMTPClient(
    host="smtp.example.com",
    port=587,
    auth=auth,
)

manager = EmailManager(
    imap=imap,
    smtp=smtp,
)

EmailManager is responsible for:

  • Sending and composing messages
  • Fetching messages and threads
  • Replying, reply-all, forwarding
  • Flags, folders, triage, unsubscribe helpers

➡️ See docs/EmailManager.md for the full API and workflows.


🔎 EmailQuery

EmailQuery is a fluent builder for IMAP searches.
It is lazy: no IMAP call is made until you execute the query.

Basic Initialization

You normally create it from EmailManager:

q = manager.imap_query(mailbox="INBOX")

Example Usage

q = (
    manager.imap_query()
           .from_any("alerts@example.com")
           .recent_unread(7)
)

page, messages = q.fetch()

EmailQuery focuses only on search construction and execution.

➡️ See docs/EmailQuery.md for all available filters and execution options.


🤖 EmailAssistant

EmailAssistant provides optional LLM-powered intelligence on top of email data.
It does not send or fetch emails by itself; it operates on EmailMessage objects.

Basic Initialization

from openmail import EmailAssistant

assistant = EmailAssistant()

With Persona Customization

from openmail import EmailAssistant, EmailAssistantProfile

profile = EmailAssistantProfile(
    name="Alex",
    role="Support Engineer",
    company="ExampleCorp",
    tone="friendly",
)

assistant = EmailAssistant(profile=profile)

EmailAssistant supports:

  • Email summarization (single, multi, thread)
  • Reply and follow-up generation
  • Task extraction
  • Prioritization and classification
  • Natural-language IMAP search construction
  • Phishing detection and sender trust evaluation

➡️ See docs/EmailAssistant.md for supported providers, models, and all methods.

Metadata

Release files for openmail 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openmail 0.1.5
File Size Uploaded
openmail-0.1.5.tar.gz 14.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for openmail 0.1.5
File Interpreter ABI Platform
openmail-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 MB

Release files / openmail-0.1.5.tar.gz

Download URL openmail-0.1.5.tar.gz
Size 14.0 MB
Tags Source
SHA-256 checksum
How to use checksums
bc0f534dba10c570ff5ae6970086dbd178bf420d5a51e2f662cbdf6b3b5470b4
BLAKE2b-256 checksum
How to use checksums
ec466f5e8887f3e3b6449e5ca02fcb31d5717954b9d7e4d9790403fb9def4438
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release files / openmail-0.1.5-py3-none-any.whl

Download URL openmail-0.1.5-py3-none-any.whl
Size 78.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc27305ec32ae8f2714002fbd612e5a7bd7a13d2f89d05d0c852285a6f5f26ac
BLAKE2b-256 checksum
How to use checksums
312338ebee0652581b74fd83886d8df8217f4fdc81421cdca1b572df1eb6f977
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page