CLI for fetching Hotmail/Outlook messages and attachments via Microsoft Graph.
Project description
Hotmail CLI
A small read-only CLI for Hotmail and Outlook.com mailboxes. It uses Microsoft Graph to search messages and download file attachments from your mailbox.
中文文档: README.zh-CN.md
Why Use This
- Works with personal Microsoft accounts such as Hotmail and Outlook.com.
- Uses Microsoft device code login, so the CLI never sees your password.
- Requests only
Mail.Read. - Downloads attachments from matching messages.
- Stores the OAuth token locally with
0600file permissions.
This tool is intentionally narrow. It does not send email, delete messages, mark messages, or manage calendars.
Installation
uvx hotmail-cli --help
Or install it into an environment:
uv tool install hotmail-cli
hotmail --help
Microsoft App Setup
You need your own Microsoft Entra app registration. This is free and lets Microsoft show you exactly what the CLI is allowed to access.
- Open the Microsoft Entra admin center.
- Go to App registrations -> New registration.
- Name it
hotmail-clior any name you prefer. - For Supported account types, choose Personal Microsoft accounts only for Hotmail/Outlook.com.
- Leave Redirect URI empty.
- Create the app.
- Open Authentication -> Settings.
- Enable Allow public client flows and save.
- Copy the Application (client) ID.
Sign In
export HOTMAIL_CLIENT_ID="your Microsoft app client id"
hotmail auth
The command prints a URL and code. Open the URL in your browser, enter the code, sign in to Microsoft, and approve the requested Mail.Read access.
The token cache is saved to:
~/.hotmail-cli/token.json
You can also pass the client id directly:
hotmail --client-id "your Microsoft app client id" auth
Search Messages
Search by subject:
hotmail search --subject "statement" --top 10
Search by subject, sender, and date range:
hotmail search \
--subject "invoice" \
--sender "billing@example.com" \
--since 2026-06-01 \
--until 2026-06-27 \
--top 10
The output is Microsoft Graph message JSON. Each message includes an id that can be used with fetch and attachments.
Microsoft Graph message $search cannot be reliably combined with $filter or $orderby, so Hotmail CLI searches by subject server-side first, then applies sender and date filters locally.
Fetch One Message
hotmail fetch MESSAGE_ID
Download Attachments
hotmail attachments MESSAGE_ID --output-dir downloads
Only Microsoft Graph fileAttachment items are saved. Inline items and reference attachments are ignored.
Local Development
uv sync
uv run pytest
uv run hotmail --help
Build the package:
uv build
Security Notes
- Do not commit
~/.hotmail-cli/token.json. - Do not share message IDs or downloaded attachments publicly.
- Revoke access anytime from your Microsoft account security page or from the app registration.
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 hotmail_cli-0.1.0.tar.gz.
File metadata
- Download URL: hotmail_cli-0.1.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ecc2532f6069ed3e2089043d1656aa779b3f137df05de372786b806016b9b04
|
|
| MD5 |
5bf185355cec8ad6e7dbe964166baeed
|
|
| BLAKE2b-256 |
0179896cddd656da27a61fca3db4d72b402f271dc02707866b15f194428d1de1
|
File details
Details for the file hotmail_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hotmail_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8ccc64dfe069bb94de4cfe077ea02355db7bff24b8e65da17e73e1108394598
|
|
| MD5 |
fda634a0be5594a657ad2879bdad7bb9
|
|
| BLAKE2b-256 |
c48ad904c1dd73305f8257a8207aac1160df6962ee42207e673c898f89a5b374
|