Skip to main content

Maco CLI

Maco CLI lets an Agent read, search, organize, and send mail using IMAP/SMTP, the Gmail API, or Microsoft Graph. Mailbox access is granted through Maco Mail Helper.

Install or upgrade

Activate a virtual environment with Python 3.9 or later and run:

python -m pip install --upgrade -r https://macomail.app/cli/downloads/install.txt
maco --version

The Maco installation manifest pins the wheel and its SHA-256 checksum.

Connect an Agent

Run maco account login --start on the machine where the Agent runs. Open the returned authorization link, verify the code, and choose the mailboxes and permissions to grant. In the same environment, run maco account login --finish <request_id>, followed by maco accounts.

List and search messages

maco emails --account work --after 2026-11-01 --before 2026-12-01
maco search --account travel "hotel reservation OR train ticket"
maco search --account qq-profile --strict --match subject "search phrase"

emails and search accept both date flags. --after starts the range and --before excludes the ending date. Gmail and Outlook use UTC for the received date. IMAP uses the calendar date of the server's internal timestamp.

Each side of uppercase OR is a literal phrase. Double quotes within the query keep a literal OR together with the enclosing phrase.

Gmail search verifies indexed candidates locally, ranks subject and sender matches first, and reads bodies as needed to fill the page. Use --native for Gmail's indexed results directly. --strict verifies up to 100 candidates for any provider. Use --match subject, --match from, or --match body to select a field. The matched_fields array identifies verified fields. strict.more_candidates indicates that additional candidates or bodies were outside the verification performed for this result. IMAP reads use BODY.PEEK in a read-only session.

Outlook sends sender and subject restrictions to Microsoft Graph's search index. Graph indexes words, names, and addresses according to Outlook search syntax. Provider queries share a 30-second request budget across pages and retries. An exhausted budget returns a JSON timeout error. Outlook marks incomplete results at the 1,000-row indexed limit with truncated.

Read messages[].id and messages[].folder for all account types. IMAP responses also expose emails, uid, and uidvalidity. Pass the IMAP folder and UIDVALIDITY from the response when reading or acting on those messages.

Configure an IMAP/SMTP proxy

Save a proxy once for this operating system user and Maco configuration directory.

maco proxy set http://127.0.0.1:8080
maco proxy show
maco proxy clear

maco proxy set without a URL saves the proxy from the current environment. Use this form when the URL includes credentials. Maco uses a private file on macOS and Linux and DPAPI on Windows. The command output shows only the proxy scheme, host, and port.

Maco checks MACO_MAIL_PROXY, the saved setting, then ALL_PROXY and HTTPS_PROXY. Lowercase names take precedence over conflicting uppercase names. NO_PROXY accepts hostname suffixes and optional ports. MACO_MAIL_PROXY=direct forces a direct connection for the current environment. maco proxy set direct saves that choice for future terminals.

With ALL_PROXY or HTTPS_PROXY, Maco uses that proxy immediately when mail DNS returns an address in 198.18.0.0/15. Otherwise, a direct TCP or implicit TLS connectivity failure gets one proxy retry. Authentication and certificate verification errors are reported directly. The last successful route is cached per server and port for 24 hours in the Maco configuration directory.

http:// uses CONNECT. Both socks5:// and socks5h:// pass the original hostname to the proxy. TLS SNI and certificate validation use the configured mail server name. Gmail API and Outlook Graph use their own HTTPS connection settings.

maco auth check reports "via": "direct" or "via": "proxy" for IMAP/SMTP. maco account login --finish reports the route for each mailbox checked during that run. When either protocol uses a proxy, the result shows "via": "proxy" with a proxy value containing its scheme, host, and port. Failed retries include the stage and reason of each attempt.

Get started at Maco Mail Helper.

Metadata

Release files for maco-cli 0.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for maco-cli 0.4.5
File Interpreter ABI Platform Actions
maco_cli-0.4.5-py3-none-any.whl Python 3 none any Details for maco_cli-0.4.5-py3-none-any.whl

Release files / maco_cli-0.4.5-py3-none-any.whl

Download URL maco_cli-0.4.5-py3-none-any.whl
Size 57.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7ea474efb9d127d4b5d381e65fb2e49a859ef530c34da345936f9a3c6967f0a
BLAKE2b-256 checksum
How to use checksums
2f674983d7348c400a4ba5ee5b754a2fc902e8709fe5e74250f7793aeb6ed40c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for maco-cli 0.4.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for maco_cli-0.4.5-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.5 This release

1 release file Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page