imap-tools
Work with email by IMAP
What it is and what it does
imap_tools is a Python library that wraps the standard library's imaplib to provide a simpler, higher-level interface for working with email via IMAP. It handles the low-level protocol details and lets you fetch messages, search by criteria, manage folders, and perform actions like copy, move, delete, and flag—all without needing external dependencies beyond Python itself.
The library parses email messages into structured objects with attributes like subject, sender, recipients, body (text and HTML variants), attachments, and headers. It includes a query builder for constructing search criteria, support for IDLE (server push notifications), and context managers for safe connection handling. It's designed for straightforward email automation tasks: monitoring inboxes, archiving, filtering, or bulk operations on messages and folders.
Use it for:
- Automated email monitoring: poll an inbox for new messages matching specific criteria and trigger actions.
- Email backup or archival: fetch and download messages from IMAP folders in bulk.
- Message filtering and organization: search emails by subject, sender, or date and move or flag them.
- Notification systems: use IDLE to wait for new mail server-side and react in real time.
- Email data extraction: parse message headers, bodies, and attachments for analysis or logging.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A high-level Python library for IMAP email operations: fetch, search, and manage messages and folders without external dependencies.
Yes. imap_tools is actively maintained, has no external dependencies, supports modern Python versions, carries no known vulnerabilities, and uses a permissive license. Install it if you need to automate IMAP email tasks in Python—it significantly simplifies the standard library's imaplib. The only caveat is that it is not thread-safe, so use separate instances per thread if needed.
Install
imap-tools on PyPI
pip
pip install imap-toolsuv
uv add imap-toolspoetry
poetry add imap-toolsInstalling imap-tools
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained—last release 8 days ago, 837 repository stars, supports Python 3.8 through 3.14.
License in practice
Apache-2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
from imap_tools import MailBox, AND
with MailBox('imap.mail.com').login('user@mail.com', 'password') as mailbox:
for msg in mailbox.fetch(AND(subject='weather')):
print(msg.subject, msg.date, msg.text)
Requires a working IMAP server and valid credentials; not thread-safe.
Verify before relying
- Performance characteristics when handling large mailboxes or bulk operations.
- Compatibility with less common IMAP server implementations or extensions.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 752,551/month — #5,152 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: imap_tools-1.15.0-py3-none-any.whl
Keywords: imap, imap-client, python3, python, email
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
IMAPClientIMAPClient provides a Pythonic interface to…
permissive · top 5,000 on PyPI
aioimaplibAn asyncio-based IMAP4rev1 client library that…
copyleft · top 15,000 on PyPI
robotframework-imaplibrary2A Robot Framework library that connects to IMAP…
permissive · top 15,000 on PyPI
pymispPyMISP is a Python library that connects to…
permissive · top 5,000 on PyPI
mailsuitemailsuite retrieves, parses, and sends emails…
permissive · top 15,000 on PyPI
mailslurp-clientMailSlurp provides a Python client for an email…
unclear · top 15,000 on PyPI
apache-airflow-providers-imapIntegrates IMAP email protocol support into…
permissive · top 5,000 on PyPI
mailosaurMailosaur is a Python client library for…
permissive · top 15,000 on PyPI
mailbitsProvides utilities for parsing, converting, and…
permissive · top 15,000 on PyPI
email-reply-parserExtracts the most recent reply from an email…
permissive · top 5,000 on PyPI