exchangelib
Client for Microsoft Exchange Web Services (EWS)
What it is and what it does
exchangelib is a Django-style ORM wrapper around Microsoft Exchange Web Services (EWS), designed to simplify programmatic access to on-premise Exchange 2007-2016 servers and Office365. It abstracts the complexity of the EWS protocol, offering a Pythonic interface for common mailbox operations: searching, creating, updating, and deleting items across mail, calendar, tasks, contacts, and distribution lists. The library includes built-in autodiscover support to locate the correct EWS endpoint automatically.
The package depends on 12 runtime libraries including requests for HTTP communication, defusedxml for secure XML parsing, OAuth support via oauthlib and requests_oauthlib, NTLM authentication via requests_ntlm, and timezone handling through tzdata and tzlocal. It requires Python 3.10 or later and is distributed as a pure Python wheel, making installation straightforward across platforms.
Use it for:
- Automate mailbox management tasks like archiving, filtering, or bulk-moving emails based on custom criteria.
- Sync Exchange calendar events to external systems or build calendar-aware applications.
- Extract contact information and distribution lists for directory synchronization or reporting.
- Build monitoring or audit tools that query mailbox metadata and message properties.
- Integrate Office365 mailbox data into data pipelines or ETL workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
exchangelib is an ORM-style client library for Microsoft Exchange Web Services (EWS), providing programmatic access to Exchange mailbox data including mail, calendar, tasks, contacts, and distribution lists.
Yes, if you need to programmatically interact with Exchange or Office365 mailboxes. The library is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. The Python 3.10+ requirement and dependency on network connectivity to an Exchange server are the only real constraints; verify autodiscover and authentication methods match your deployment before committing.
Install
exchangelib on PyPI
pip
pip install exchangelibuv
uv add exchangelibpoetry
poetry add exchangelibInstalling exchangelib
Before you install
Low install friction with a pure Python wheel distribution. The package is actively maintained with a recent release and 1268 repository stars, indicating stable community adoption.
License in practice
BSD-2-Clause is a permissive license that allows commercial and private use with minimal restrictions, making this package suitable for most projects.
Quickstart
from exchangelib import Credentials, Account
credentials = Credentials("user@example.com", "password")
account = Account("user@example.com", credentials=credentials, autodiscover=True)
for item in account.inbox.all()[:10]:
print(item.subject, item.sender)
Requires Python 3.10 or later; Exchange server connectivity and valid credentials required.
Verify before relying
- Whether autodiscover works reliably across all Exchange versions (2007-2016) and Office365 tenants.
- Performance characteristics when handling large mailboxes or complex queries.
- Specific authentication methods supported beyond basic credentials and OAuth.
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 12 — cached_property, defusedxml, dnspython, isodate, lxml, oauthlib, pygments, requests, requests_ntlm, requests_oauthlib, tzdata, tzlocal |
| Maintenance | actively maintained — 308 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,049,110/month — #3,340 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: exchangelib-5.6.0-py3-none-any.whl
Keywords: autodiscover, ews, exchange, exchange-web-services, microsoft, o365, office365, outlook
Tags
More Communications packages
Pyasn1 encodes and decodes ASN.1 data…
permissive · top 100 on PyPI
pyasn1-modulesProvides a collection of ASN.1 data structures…
permissive · top 100 on PyPI
kombuKombu is a messaging library that provides a…
permissive · top 1,000 on PyPI
humanfriendlyFormats and parses numbers, file sizes,…
permissive · top 1,000 on PyPI
coloredlogsAdds colored output to Python's standard…
permissive · top 1,000 on PyPI
aiosmtplibaiosmtplib is an asynchronous SMTP client that…
permissive · top 5,000 on PyPI
office365Wraps the O365 library to provide a…
permissive · top 15,000 on PyPI
o365O365 provides a Pythonic interface to Microsoft…
permissive · top 5,000 on PyPI
nylasOfficial Python SDK for the Nylas API platform,…
permissive · top 15,000 on PyPI
microsoftgraph-pythonA Python wrapper for the Microsoft Graph API…
permissive · top 15,000 on PyPI
exchange_calendarsProvides trading calendars for more than 50…
permissive · top 5,000 on PyPI
SharePlumSharePlum provides a Python interface to…
permissive · top 5,000 on PyPI
imap-toolsA high-level Python library for IMAP email…
permissive · top 15,000 on PyPI
IMAPClientIMAPClient provides a Pythonic interface to…
permissive · top 5,000 on PyPI
pandas_market_calendarsProvides market and exchange trading calendars…
permissive · top 5,000 on PyPI
langchain-google-calendar-toolsIntegrates Google Calendar with LangChain to…
unclear · top 15,000 on PyPI