skillfed

imap-tools

Work with email by IMAP

imap-tools v1.15.0 752.6K downloads/30d#5,152 on PyPI837
Permissive license Apache-2.0 Active released

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

uv

uv add imap-tools

poetry

poetry add imap-tools

Installing 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

License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

imap email client libraryfetch emails pythonimap message searchemail folder managementimap idle monitoringpython email automationimap query builder
email-automationimap-client

More Internet packages