API for managing your email
Project description
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.
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 openmail-0.1.5.tar.gz.
File metadata
- Download URL: openmail-0.1.5.tar.gz
- Upload date:
- Size: 14.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc0f534dba10c570ff5ae6970086dbd178bf420d5a51e2f662cbdf6b3b5470b4
|
|
| MD5 |
3dd5b18b8f9b6ba82e4ce5d9191c275a
|
|
| BLAKE2b-256 |
ec466f5e8887f3e3b6449e5ca02fcb31d5717954b9d7e4d9790403fb9def4438
|
File details
Details for the file openmail-0.1.5-py3-none-any.whl.
File metadata
- Download URL: openmail-0.1.5-py3-none-any.whl
- Upload date:
- Size: 78.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc27305ec32ae8f2714002fbd612e5a7bd7a13d2f89d05d0c852285a6f5f26ac
|
|
| MD5 |
98480b1bd866f53f543b1e2bddf94e38
|
|
| BLAKE2b-256 |
312338ebee0652581b74fd83886d8df8217f4fdc81421cdca1b572df1eb6f977
|