skillfed

exchangelib

Client for Microsoft Exchange Web Services (EWS)

exchangelib v5.6.0 2.0M downloads/30d#3,340 on PyPI1,268
Permissive license BSD-2-Clause Active released

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 exchangelib

uv

uv add exchangelib

poetry

poetry add exchangelib

Installing 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

Development Status :: 5 - Production/StableProgramming Language :: Python :: 3Topic :: Communications

Tags

exchange web services clientmicrosoft exchange mailbox accessews python libraryoffice365 mailbox automationexchange calendar contacts tasks
email-automationexchange-integration

More Communications packages