Reference · cmail 0.4.0
Command-line docs
Every command, setting and output format. New here? Start with the setup guide.
Install
curl -fsSL https://raw.githubusercontent.com/luongnv89/cmail/main/install.sh | bash
export PATH="$HOME/.local/bin:$PATH"
cmail --version
With Homebrew (also installs shell completions):
brew install luongnv89/tap/cmail
To build a clone you reviewed instead (needs Rust and cargo):
git clone https://github.com/luongnv89/cmail
cd cmail
bash install.sh --local # or: cargo install --path .
| What | Where | Override |
|---|---|---|
| Binary | ~/.local/bin/cmail | CMAIL_BIN_DIR at install |
| Config | ~/.config/cmail/.env (or $XDG_CONFIG_HOME/cmail/.env) | --config, CMAIL_CONFIG or ENV_FILE |
- cmail is one self-contained binary for macOS and Linux (x86_64 and arm64). The one-line command downloads the release build for your system from GitHub and checks its SHA-256 checksum before installing it.
--localbuilds the checkout you cloned. - The installer says whether
~/.local/binis on your PATH and prints theexport PATHline to add to your shell profile if it is not. - No runtime dependencies: no Bash,
curlorjqneeded to run cmail.gddyis needed only for GoDaddy mode. No sudo. Installing never runs setup or edits your shell profile. - Proxies: cmail does not use
HTTPS_PROXYorALL_PROXYyet. It connects directly toapi.cloudflare.comover HTTPS, so it needs direct internet access. The installer's download does follow your proxy settings. - To update, run the installer again,
brew upgrade cmail, or pull and rerun--local. Your config is kept.
Commands
| Command | What it does | Changes things? |
|---|---|---|
cmail setup | Guided receiving setup in a terminal | Yes, asks first |
cmail setup --dry-run | Full plan and blockers | No |
cmail status | Zone, routing, destinations and rules | No |
cmail list [--domain D] | Every address and where it forwards | No |
cmail forward ADDRESS --destination EMAIL | Change where an existing address forwards | Yes, asks first |
cmail doctor | Check config, gddy (GoDaddy mode) and token | No |
cmail doctor --offline | Same, without network requests | No |
cmail send-as | Optional Gmail sending guide | No (manual) |
cmail config init | Create a private config file | Local file |
cmail config show | Show settings, secrets redacted | No |
cmail config check | Validate settings | No |
cmail config set KEY VALUE | Update one setting | Local file |
cmail config path | Print the config path in use | No |
cmail completion SHELL | Print bash, zsh or fish completions | No |
cmail help [COMMAND] | Help for any command | No |
$ cmail list ╭─┐example.com addresses┌──────────────────────────────────────────╮ │ [email protected] → [email protected] (verified) ✗ disabled │ │ [email protected] → [email protected] (verified) ● enabled │ ├──────────────────────────────────────────────────────────────────┤ │ catch-all → drop ✗ disabled │ ╰─┘2 addresses└────────────────────────────────────────────────────╯ $ cmail doctor --offline ╭─┐cmail doctor┌──────────────────────────────────────────────╮ │ ● pass config configuration ready │ │ ● pass registrar manual registrar mode; gddy not required │ ╰─┘2 checks · 2 ok└───────────────────────────────────────────╯
Configuration
Settings live in one private file (mode 600). cmail setup fills it for you; set values ahead of time if you prefer:
cmail config set DOMAIN example.com
cmail config set DEST_EMAIL [email protected]
cmail config set ADDRESSES hello,contact
cmail config set CLOUDFLARE_API_TOKEN --stdin < /path/to/private/token
cmail config check
| Key | Meaning |
|---|---|
DOMAIN | Your domain, e.g. example.com |
DEST_EMAIL | Inbox that receives the mail |
ADDRESSES | Comma-separated names: hello,contact |
CLOUDFLARE_API_TOKEN | Scoped API token (secret; set via --stdin or setup’s hidden prompt) |
REGISTRAR | manual (default) or godaddy |
CF_ACCOUNT_ID | Optional. Pick a Cloudflare account when you have several |
CF_ZONE_ID | Saved by setup. No need to set |
GDDY_ENV, GDDY_PAT | GoDaddy mode only: environment and optional token |
DRY_RUN | 1 = same as setup --dry-run |
Precedence: command option → environment variable → config file → default. Pick another file with --config PATH or CMAIL_CONFIG.
Values are plain literals. Shell commands and $(…) expansions are rejected. Secrets never go on the command line.
Registrar modes
manual · default
Any registrar. cmail prints the Cloudflare nameservers; you set them at your registrar while cmail waits. It never changes delegation and never buys a domain.
godaddy · opt-in
Uses the gddy CLI to pick a GoDaddy domain and switch nameservers after you confirm. The only mode that can offer a purchase, which needs the domain typed at a terminal.
cmail setup --domain example.com # any registrar
cmail setup --registrar godaddy # opt in once
cmail config set REGISTRAR godaddy # opt in permanently
Preview & JSON
setup --dry-run previews the whole workflow: no provider changes, purchases, config writes or browser launches. It exits 0 even with blockers, so read data.blockers.
cmail setup --dry-run --format json
cmail status --format json | jq '.data.rules'
cmail doctor --offline --format json
JSON is available for status, list, doctor, config show/check and previews:
{"schema_version":1,"command":"status","data":{"zone":{},"routing":{},"destinations":[],"rules":[]}}
Global options
-c, --config PATH | Use a specific config file |
-f, --format text|json | Report format |
-v, --verbose / -q, --quiet | More (redacted) detail / less progress |
--no-color | No color (also NO_COLOR); FORCE_COLOR=1 styles output that is not a terminal |
--no-browser | Print links instead of opening them |
--timeout SECONDS | HTTP timeout, default 30 |
setup --wait-timeout SECONDS | Each activation/verification wait, default 1200 |
-h, --help · -V, --version | Help and version |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success, or report generated |
| 1 | Runtime or check failure |
| 2 | Invalid arguments, or no terminal available |
| 3 | Invalid or incomplete input/config |
| 130 | Interrupted (Ctrl+C) |
| 143 | Terminated (SIGTERM) |
Shell completions
Homebrew installs completions automatically. Otherwise:
# bash
cmail completion bash > ~/.cmail-completion.bash
echo 'source ~/.cmail-completion.bash' >> ~/.bashrc
# zsh (put fpath before compinit in .zshrc)
mkdir -p ~/.zfunc && cmail completion zsh > ~/.zfunc/_cmail
# fish
cmail completion fish > ~/.config/fish/completions/cmail.fish