aioimaplib
Python asyncio IMAP4rev1 client library
What it is and what it does
aioimaplib is an asyncio port of Python's standard imaplib, designed to let you interact with IMAP mail servers using async/await syntax instead of blocking I/O. It has no runtime dependencies and implements 23 of 25 IMAP4rev1 commands from RFC 3501, plus RFC 2177 IDLE support for efficient server-push notification of new messages.
The library is tested against Python 3.9 through 3.12 and actively maintained. It handles concurrent IMAP commands according to protocol rules (sync commands block; async commands can run in parallel), supports SSL connections, and integrates with Python's standard logging. IDLE mode lets you wait for new mail without CPU-intensive polling by reading server pushes from an async queue. Note that close() only closes the mailbox state, not the TCP connection; you must call logout() to properly disconnect.
Use it for:
- Build a mail-fetching daemon that checks multiple IMAP accounts concurrently without blocking threads
- Implement real-time email notifications using IDLE mode to wait for new messages on the server
- Integrate IMAP mailbox access into an asyncio-based web service or bot without spawning threads
- Migrate existing imaplib code to async/await for better concurrency in I/O-bound applications
- Monitor multiple mailboxes in parallel and react to server-pushed events as they arrive
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
An asyncio-based IMAP4rev1 client library that brings async/await support to email mailbox operations, with no runtime dependencies and support for IDLE mode to wait for new messages without polling.
Yes, if you need async IMAP access in a Python 3.9+ asyncio application and accept GPLv3 copyleft. The library is actively maintained, has zero known vulnerabilities, installs with no dependencies, and covers the majority of IMAP commands. Not suitable for proprietary closed-source projects due to license; consider alternatives if you need STARTTLS or AUTHENTICATE (non-XOAUTH2) support.
Install
aioimaplib on PyPI
pip
pip install aioimaplibuv
uv add aioimaplibpoetry
poetry add aioimaplibInstalling aioimaplib
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits and tested against Python 3.9, 3.10, 3.11, 3.12.
License in practice
GPLv3 copyleft license: any derivative work or software that links this library must also be released under GPLv3. Acceptable for open-source projects; requires careful review for proprietary or closed-source applications.
Quickstart
import asyncio
from aioimaplib import aioimaplib
async def check_mailbox(host, user, password):
imap_client = aioimaplib.IMAP4_SSL(host=host)
await imap_client.wait_hello_from_server()
await imap_client.login(user, password)
res, data = await imap_client.select()
print(f'Messages in INBOX: {data[0]}')
await imap_client.logout()
asyncio.run(check_mailbox('my.imap.server', 'user', 'pass'))
Requires Python 3.9 or later. IMAP4ClientProtocol is not thread-safe; each instance must run in the same thread.
Verify before relying
- Whether OAuth2 support works reliably with Google Mail (documented as tested with Outlook only as of 2023-01-01)
- Compatibility with IMAP servers beyond those listed (dovecot, Gmail, Outlook, Yahoo, free.fr, orange.fr, mailden.net)
Package facts
| License | GPL-3.0 (copyleft) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 575 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 721,738/month — #5,230 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aioimaplib-2.0.1-py3-none-any.whl
Keywords: asyncio, mail, imap
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
IMAPClientIMAPClient provides a Pythonic interface to…
permissive · top 5,000 on PyPI
imap-toolsA high-level Python library for IMAP email…
permissive · top 15,000 on PyPI
fastapi-mailSends emails and attachments asynchronously…
permissive · top 5,000 on PyPI
aiosmtplibaiosmtplib is an asynchronous SMTP client that…
permissive · top 5,000 on PyPI
aiocoapaiocoap is a Python library for writing CoAP…
permissive · top 15,000 on PyPI
robotframework-imaplibrary2A Robot Framework library that connects to IMAP…
permissive · top 15,000 on PyPI
apache-airflow-providers-imapIntegrates IMAP email protocol support into…
permissive · top 5,000 on PyPI
aioresponsesMocks HTTP requests made by aiohttp's…
permissive · top 5,000 on PyPI
mailsuitemailsuite retrieves, parses, and sends emails…
permissive · top 15,000 on PyPI
aioftpaioftp provides an async FTP client and server…
permissive · top 15,000 on PyPI