imaplib2 is a threaded Python IMAP4 client library, compatible with Python 3.6+. Version 3.6 is the latest stable release. It is maintained by the Jazzband community and provides an alternative to the standard library's imaplib, with threading support and improved performance.
pip install imaplib2Verified import paths — ran on the pinned version, not inferred.
Connect to an IMAP server, login, select inbox, and search for all messages.
Replace `keyfile` and `certfile` arguments with `ssl.SSLContext` object passed to `IMAP4_SSL`.
Use `IMAP4_SSL` for SSL connections, not `IMAP4`.
Avoid forking after establishing an IMAP session. Reconnect in child processes if needed.
Use `from imaplib2 import IMAP4` or `import imaplib2; imaplib2.IMAP4` (imaplib2 exposes IMAP4 as alias).
Ensure you call `login()` or `authenticate()` before any mailbox commands.
Implement reconnect logic. Use try/except and re-instantiate connection.
No dependency data recorded yet.