CLI tool for Microsoft Outlook — search/read/send emails, list/read/create calendar events
Project description
outlook-cli
A command-line tool for Microsoft Outlook (Work/School accounts). Search, read, send, and reply to emails. List, read, and create calendar events. Built with the O365 library and Typer.
Prerequisites
- Python 3.11+
- uv package manager
- An Azure App Registration (free) with Microsoft Graph delegated permissions:
Mail.ReadWriteMail.SendCalendars.ReadWrite
Azure App Setup
- Go to Azure Portal > App registrations
- Click New registration
- Name it anything (e.g. "Outlook CLI"), set Supported account types to your preference
- Under Authentication > Advanced settings, set Allow public client flows to Yes and save
- Under API permissions, add the three Delegated permissions listed above
- If your tenant requires admin consent, have an admin grant consent for the app
- Copy the Application (client) ID — you'll need it for
outlook auth login
Installation
git clone https://github.com/mhattingpete/outlook-cli.git
cd outlook-cli
uv sync
Getting Started
# Authenticate with your Azure app
outlook auth login --client-id YOUR_CLIENT_ID
# Follow the device code flow — open the URL and enter the code
# Check status
outlook auth status
Commands
Authentication
outlook auth login [--client-id ID] [--tenant-id ID] # Authenticate via device code flow
outlook auth logout # Remove stored token
outlook auth status # Show auth status and config
# Search / list messages
outlook mail search # List recent inbox messages
outlook mail search "quarterly report" # Full-text search
outlook mail search --unread # Unread messages only
outlook mail search --from alice@company.com # Filter by sender
outlook mail search --start-date 2025-01-01 --end-date 2025-02-01
outlook mail search --important --has-attachments # Combine filters
outlook mail search --folder "Sent Items" --limit 10 # Different folder
# Read a message
outlook mail read MESSAGE_ID
# Send a message
outlook mail send --to bob@company.com --subject "Hello" --body "Hi Bob!"
outlook mail send --to bob@company.com --cc carol@company.com --subject "Update" --body "FYI"
# Reply to a message
outlook mail reply MESSAGE_ID --body "Thanks for the update!"
outlook mail reply MESSAGE_ID --body "Noted, thanks." --reply-all
# Mark as read/unread
outlook mail mark MESSAGE_ID # Mark as read (default)
outlook mail mark MESSAGE_ID --unread # Mark as unread
Calendar
# List events (default: next 7 days)
outlook cal list
outlook cal list --start 2025-03-01 --end 2025-03-31 # Custom date range
outlook cal list --subject "standup" # Filter by subject
outlook cal list --location "Room A" # Filter by location
outlook cal list --all-day # All-day events only
outlook cal list --recurring # Recurring events only
outlook cal list --organizer boss@company.com # Filter by organizer
# Read event details (shows attendees, recurrence, etc.)
outlook cal read EVENT_ID
# Create an event
outlook cal create --subject "Lunch" --start "2025-02-08 12:00" --end "2025-02-08 13:00"
outlook cal create --subject "Workshop" \
--start "2025-02-10 09:00" --end "2025-02-10 17:00" \
--body "Full day workshop" --location "Conference Room B"
Configuration
Config and tokens are stored in ~/.outlook-cli/:
~/.outlook-cli/
├── config.toml # client_id, tenant_id
└── o365_token.token # OAuth token (auto-managed)
Development
# Install dev dependencies
uv sync
# Run tests
uv run pytest tests/ -v
# Run the CLI
uv run outlook --help
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file outlook_cli-0.2.0.tar.gz.
File metadata
- Download URL: outlook_cli-0.2.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a2fb40823c94885000e6bfb13d88a16e28735384df521cbd2e6a36eedb8b7cb
|
|
| MD5 |
5fb2e9c06bfd4898ea0915f8071f74d4
|
|
| BLAKE2b-256 |
46c72424ec407f92851dc96ecc645e2709d42bb4f178ccc056953972fe981ca3
|
Provenance
The following attestation bundles were made for outlook_cli-0.2.0.tar.gz:
Publisher:
publish.yml on mhattingpete/outlook-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
outlook_cli-0.2.0.tar.gz -
Subject digest:
7a2fb40823c94885000e6bfb13d88a16e28735384df521cbd2e6a36eedb8b7cb - Sigstore transparency entry: 938168497
- Sigstore integration time:
-
Permalink:
mhattingpete/outlook-cli@71e43180fba0e987634af5f936a30126a1a1d669 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mhattingpete
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@71e43180fba0e987634af5f936a30126a1a1d669 -
Trigger Event:
release
-
Statement type:
File details
Details for the file outlook_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: outlook_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6836a5faf81b23fe61e516bc24c1f96ad472b68487903737b1d9cef9bae30af
|
|
| MD5 |
8dd9c6c43c18db077da2f05e56f30bb2
|
|
| BLAKE2b-256 |
d8280265587ed26a9dd3d6f7643e0508d48eba85753de2515efbf8dbf1ee925e
|
Provenance
The following attestation bundles were made for outlook_cli-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on mhattingpete/outlook-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
outlook_cli-0.2.0-py3-none-any.whl -
Subject digest:
b6836a5faf81b23fe61e516bc24c1f96ad472b68487903737b1d9cef9bae30af - Sigstore transparency entry: 938168506
- Sigstore integration time:
-
Permalink:
mhattingpete/outlook-cli@71e43180fba0e987634af5f936a30126a1a1d669 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mhattingpete
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@71e43180fba0e987634af5f936a30126a1a1d669 -
Trigger Event:
release
-
Statement type: