Home
Official SDKs

CLI

Interactive TropMail inbox and JSON-friendly scripting commands.
brew install tropmail/tap/tropmail
go install github.com/tropmail/tropmail-cli@latest

Binaries for linux, macOS, and Windows on amd64 and arm64 are on each release. There is also a container image:

docker run --rm -e TROPMAIL_API_KEY -e TROPMAIL_MAILBOX_ID ghcr.io/tropmail/tropmail ls --json

Source: github.com/tropmail/tropmail-cli

Getting started

tropmail auth login          # prompts, stores the key in the OS keyring
tropmail mailboxes           # list inbox UUIDs this key can see
tropmail                     # opens the inbox

auth login checks the key with the API before saving it, so a typo fails immediately. If the key sees exactly one inbox, that id is remembered on the profile. Otherwise pass --mailbox or set TROPMAIL_MAILBOX_ID.

The inbox

Running tropmail with no arguments opens a two-pane reader: the message list on the left, the rendered body on the right.

KeyAction
j / k, ↓ / ↑move
ctrl+d / ctrl+upage
g / Gtop / bottom
enterread the selected message
tabswitch panes
escback to the list
/search
sfilter by status
rrefresh
vcycle markdown, text, HTML
aattachments
ycopy the message id
o / cmark opened / closed
ffavorite
bblock the sender
uclear the action
ddelete
?full help
qquit

Markdown is rendered in the reader. The next page loads in the background as you approach the end of the list.

Scripting

Every subcommand takes --json. Mail commands need a mailbox UUID (--mailbox, TROPMAIL_MAILBOX_ID, or the unique inbox remembered at login).

# List inboxes
tropmail mailboxes --json | jq -r '.mailboxes[].id'

# The subject of every unread message
tropmail ls --mailbox "$MAILBOX_ID" --status Open --json | jq -r '.emails[].subject'

# Read the newest message as plain markdown
tropmail read --mailbox "$MAILBOX_ID" "$(tropmail ls --mailbox "$MAILBOX_ID" --limit 1 --json | jq -r '.emails[0].id')" --raw

# Favorite everything from one sender
tropmail search --mailbox "$MAILBOX_ID" "billing@stripe.com" --all --json \
  | jq -r '.emails[].id' \
  | xargs tropmail fav --mailbox "$MAILBOX_ID"

# Save every attachment on a message (default: ./downloads/<id-prefix>/)
tropmail attach download <email-id> --email
tropmail attach download <email-id> --email -o ./my-inbox

# Start a malware scan. Without --wait this returns while the scan is still running.
tropmail attach scan <attachment-id> --wait
tropmail attach info <attachment-id>

# Run a hook whenever mail arrives
tropmail watch --exec 'notify-send "TropMail" "$TROPMAIL_SUBJECT"'

watch prints one NDJSON object per new message under --json, and exposes $TROPMAIL_ID, $TROPMAIL_SUBJECT, $TROPMAIL_FROM, and $TROPMAIL_TIMESTAMP to the --exec hook.

Exit codes

CodeMeaning
0success
1error
2usage
3authentication or plan
4not found
5rate limited

Under --json, errors are written to stderr as JSON with the status, message, and request id.

Commands

CommandPurpose
auth login|status|logout|profilesmanage API keys and profiles
mailboxeslist inboxes this key can see
mailbox [id]address and message counts for one inbox
lslist messages, --status, --all
search <query>full-text search
read <id>print one message, --view, --raw
open|close|fav|block|unblock|delete <id>...change state or status
attach ls|info|scan|downloadattachments (scan --wait waits for the result)
watchpoll for new mail
completion <shell>shell completions
versionversion, commit, build date

Global flags: --json, --api-key, --base-url, --profile, --mailbox, --timeout, --no-color, --quiet, --throttle.

Configuration

Profiles live in ~/.tropmail/config.toml (or $TROPMAIL_CONFIG_DIR):

default_profile = "default"

[profiles.default]
email = "quiet-otter-1423@tropmail.com"
tier = "Pro"
# mailbox_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"  # set by login when unique
# base_url = "https://api.tropmail.com/api/v1"  # default; set only to override

API keys never go in that file. They go to the OS keyring, or a restricted credentials file on machines with no keyring. TROPMAIL_API_KEY overrides whatever is stored, which is what CI should use.

Message bodies are fetched for display and are not stored on disk. Attachments you download are written to ./downloads/<id-prefix>/ (or -o).

Requests stay within your account rate limit. Pass --throttle=false if you would rather manage that yourself.