Skip to main content

zog

License: MIT Python 3.10+

zog is a Python CLI for Zoho Mail, designed to feel familiar to anyone who already uses gog for Google services. It keeps the dependency set small, uses argparse, stores credentials under ~/.config/zogcli/, and supports both machine-readable and terminal-friendly output.

Install

pipx install zog-cli
uv tool install zog-cli

For local development:

uv venv
source .venv/bin/activate
uv pip install -e .[dev]

Quickstart

pipx install zog-cli
zog auth add me@example.com

This opens your browser to authorize zog. After you click Allow, the CLI captures the authorization callback automatically and stores your tokens locally.

For headless servers or SSH sessions without port forwarding, use the out-of-band flow:

zog auth add me@example.com --no-browser

For power users who want to use their own Zoho app, use --self-client.

Usage

Authorize your mailbox:

zog auth add you@yourdomain.com

Search mail:

zog mail search -a you@yourdomain.com "from:cloudflare" --max 3

List folders:

zog mail folders -a you@yourdomain.com

Dry-run a send:

zog mail send \
  -a you@yourdomain.com \
  --to friend@example.com \
  --subject "zog test" \
  --body "hello from zog" \
  --dry-run

Importing existing Zoho credentials

If you already have a JSON file with client_id, client_secret, and refresh_token from a previous Zoho Self Client setup, you can import it directly:

zog auth import-legacy /path/to/credentials.json

Command Reference

zog auth add <email> [--services mail] [--no-browser] [--port N]
zog auth list
zog auth remove <email>
zog auth import-legacy <path>

zog mail search -a <email> "<query>" [--max N] [-j|-p]
zog mail get -a <email> <messageId> [-j|-p]
zog mail thread get -a <email> <threadId> [-j|-p]
zog mail send -a <email> --to ... --subject ... --body ...
zog mail folders -a <email> [-j|-p]

zog --version

Global flags follow gog-style conventions:

  • -a, --account
  • -j, --json
  • -p, --plain
  • -n, --dry-run
  • -v, --verbose
  • -h, --help

Output Modes

  • Default: aligned table output for list-style commands.
  • --json: {"status": "...", "data": ...} envelope.
  • --plain: stable TSV for scripting.

OAuth Setup

By default zog auth add uses Zoho's OAuth 2.0 Authorization Code flow with a local loopback server, so no manual Self Client setup is required. If you prefer to use your own Zoho app, use the --self-client flag:

zog auth add you@yourdomain.com --self-client

Then create or select a Self Client in the Zoho API Console:

https://api-console.zoho.com/

Use these scopes:

ZohoMail.messages.ALL,ZohoMail.accounts.READ,ZohoMail.folders.READ

Contributing

  1. Create a virtual environment with uv venv.
  2. Install the package in editable mode with uv pip install -e .[dev].
  3. Run pytest -q.
  4. Keep changes small, typed, and focused.

See LICENSE for license terms.

Setting up your own Zoho application

zog carries no client secret. Before adding an account, create a Zoho application in the Zoho API console and export its secret:

export ZOG_CLIENT_SECRET=your-client-secret
export ZOG_CLIENT_ID=your-client-id   # optional, only for your own app
zog auth add

An embedded secret used to ship in this repository, which is public, so anyone could stand up a consent page under that application's name. The secret has to come from the environment now and there is no fallback.

Metadata

Release files for zog-cli 0.3.2

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

Source distribution (sdist)

Source distribution for zog-cli 0.3.2
File Size Uploaded
zog_cli-0.3.2.tar.gz 31.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zog-cli 0.3.2
File Interpreter ABI Platform
zog_cli-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 64.9 kB

Release files / zog_cli-0.3.2.tar.gz

Download URL zog_cli-0.3.2.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bf809933d6949a1dac9edd1472a820f6f1bfc5bdb0f47405fbe2ffeace6ddc0b
BLAKE2b-256 checksum
How to use checksums
f0905cf4efc7d353e4882f9912bff09707f51ff32395d0f240f65bc3f4dcaee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release files / zog_cli-0.3.2-py3-none-any.whl

Download URL zog_cli-0.3.2-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b57e992b5ef968ee7afa1659351f7c93d6d4eae3daf7d7134f34240e805d878d
BLAKE2b-256 checksum
How to use checksums
b22d7880f9bff776f9fb31ece143a5932d0a2fd6bf471154fbcef53cd888518f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

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