Set up OfficeMail CLI — OAuth login, manual JMAP configuration, token refresh, auth troubleshooting, multi-profile management, and connection diagnostics (doctor). Use when the user asks to log in, configure auth, fix connection issues, manage multiple accounts, or set up omail for the first time.
This tool connects only to the OfficeMail service (Cyrus IMAP + Postfix based).
$ARGUMENTS = doctor → skip to Diagnostics section$ARGUMENTS = login → skip to Re-authenticate$ARGUMENTS = logout → skip to Logout$ARGUMENTS = reset → skip to Reset$ARGUMENTS = report → skip to Report (send debug logs)$ARGUMENTS = status → skip to Multi-profile commands section$ARGUMENTS = alias → skip to section${CLAUDE_PLUGIN_DATA}/omail
${CLAUDE_PLUGIN_DATA}/omail --version
If missing, ask the user to restart the session.
Ask the user for their email address, then run:
${CLAUDE_PLUGIN_DATA}/omail auth setup --email <email>
${CLAUDE_PLUGIN_DATA}/omail --profile work auth setup --email <email>
Always use prod (default). Only add --env dev if the user explicitly requests dev.
A browser window will open for authentication. The user clicks "Sign in", completes OAuth login in the popup, and tokens are saved automatically.
${CLAUDE_PLUGIN_DATA}/omail auth setup --url <officemail-domain> --token <token>
${CLAUDE_PLUGIN_DATA}/omail --profile work auth setup --url <domain> --token <token>
${CLAUDE_PLUGIN_DATA}/omail doctor
${CLAUDE_PLUGIN_DATA}/omail mail +triage
If this returns inbox data, setup is complete.
${CLAUDE_PLUGIN_DATA}/omail auth setup # Add account (OAuth or manual)
${CLAUDE_PLUGIN_DATA}/omail --profile <name> auth setup # add account to a named profile
${CLAUDE_PLUGIN_DATA}/omail auth login # Re-authenticate existing profile
${CLAUDE_PLUGIN_DATA}/omail auth logout # clear credentials for current profile (keeps config)
${CLAUDE_PLUGIN_DATA}/omail auth reset # delete all profiles, credentials, and config
${CLAUDE_PLUGIN_DATA}/omail auth token <t> # update Bearer token
${CLAUDE_PLUGIN_DATA}/omail auth whoami # verify current session
${CLAUDE_PLUGIN_DATA}/omail auth refresh # force refresh session cache
${CLAUDE_PLUGIN_DATA}/omail auth list # list all profiles
${CLAUDE_PLUGIN_DATA}/omail auth switch <name> # change default profile
${CLAUDE_PLUGIN_DATA}/omail auth remove <name> # remove a profile
${CLAUDE_PLUGIN_DATA}/omail auth rename <old> <new> # rename a profile
${CLAUDE_PLUGIN_DATA}/omail auth status # health check all profiles
${CLAUDE_PLUGIN_DATA}/omail auth alias add <profile> <alias> # add alias
${CLAUDE_PLUGIN_DATA}/omail auth alias remove <profile> <alias> # remove alias
${CLAUDE_PLUGIN_DATA}/omail auth alias list [profile] # list aliases
Send system info and CLI debug logs (JSONL) as an email. Ask the user for the recipient email address, then run:
${CLAUDE_PLUGIN_DATA}/omail auth report <email>
${CLAUDE_PLUGIN_DATA}/omail --profile work auth report <email>
${CLAUDE_PLUGIN_DATA}/omail --profile work mail +triage # use "work" profile
${CLAUDE_PLUGIN_DATA}/omail --profile personal mail +send --to ...
omail auth login re-authenticates the current profile.
OAuth profiles re-open the browser for login. Manual profiles prompt for a new token.
Always execute the login command directly — never tell the user to run it themselves. The command opens a browser for OAuth automatically; the user completes login there. No interactive input is needed for OAuth profiles.
${CLAUDE_PLUGIN_DATA}/omail auth login
${CLAUDE_PLUGIN_DATA}/omail --profile work auth login
Clear credentials (token + session cache) for the current profile but keep the profile config so the user can re-login without re-entering the server URL.
${CLAUDE_PLUGIN_DATA}/omail auth logout
${CLAUDE_PLUGIN_DATA}/omail --profile work auth logout
After logout, run omail auth login to re-authenticate.
Delete all profiles, credentials, session caches, and the config file. This is a full factory reset — the user must set up from scratch.
${CLAUDE_PLUGIN_DATA}/omail auth reset
${CLAUDE_PLUGIN_DATA}/omail doctor # diagnose connection, auth, capabilities
~/.config/officemail/config.json (chmod 600){ default, profiles: { name: config } } format--profile selects auth credentials; --account overrides JMAP accountIdprofile parameter for per-call profile selectionaccount_switch sets session-level default (in-process, does not persist)