open-mail-cli
Gives the agent the ability to send, receive, search, and manage emails directly from the terminal or via a local HTTP API. Use this skill when the agent needs to handle email tasks: sending messages, reading inbox, replying, forwarding, managing contacts, organizing with tags/folders/filters, scheduling background sync, setting up webhooks for new email events, or automating email workflows. Supports structured output (--format json/markdown/html), field selection (--fields), standardized exit codes, and a local REST API with OpenAPI docs. Works with IMAP/SMTP providers including Gmail, Outlook, QQ Mail, and others. Activates on keywords: send email, check inbox, reply, forward, email automation, contacts, email template, notifications, webhook, http api, format json, field selection, serve, openapi.
NPX Install
npx skill4agent add eric8810/open-mail-cli open-mail-cliTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Open Mail CLI - Agent Email Toolkit
mail-cliInstallation
npm install -g open-mail-cli
# Requirements: Node.js >= 18.0.0Getting Started
1. Configure an Email Account
# Interactive wizard (recommended)
mail-cli config
# Or manual setup
mail-cli account add --email user@gmail.com --name "My Gmail" \
--imap-host imap.gmail.com --imap-port 993 \
--smtp-host smtp.gmail.com --smtp-port 465 \
--username user@gmail.com --password "app-password" --test2. Sync, Read, and Send
mail-cli sync # Fetch emails from server
mail-cli list --unread # Browse unread emails
mail-cli list --format json --fields id,subject,from # Structured output for parsing
mail-cli read <email-id> # Read a specific email
mail-cli send --to user@example.com --subject "Hello" --body "Content"Capabilities Overview
Output Control & Error Handling
Reference: references/output-and-errors.md
--format json/markdown/html--fieldsWebhooks & HTTP API
Reference: references/webhooks-and-api.md
Sending & Composing
Reference: references/sending-and-replying.md
Reading & Searching
Reference: references/reading-and-searching.md
Organization
Reference: references/organization.md
Accounts & Sync
Reference: references/accounts-and-sync.md
Automation
Reference: references/automation.md
Key Principles
- Sync before read: Local storage is offline-first. Always before listing or searching if fresh data is expected.
mail-cli sync - Confirm before send: Always verify recipient, subject, and content with the user before executing ,
send, orreply.forward - Non-destructive by default: moves to trash. Only use
deletewhen the user explicitly requests irreversible deletion.--permanent - Use for automation: Skip interactive confirmation prompts in automated workflows.
--yes - Use for parsing: When the agent needs to parse output programmatically, use JSON format. Use
--format jsonwhen output is consumed by an LLM.--format markdown - Use to reduce noise: Request only the fields needed (e.g.
--fields) to keep output focused and reduce token usage.--fields id,subject,from - Check exit codes for error handling: Exit codes indicate error category (0=success, 1=general, 2=validation, 3=network, 4=auth). Branch logic based on exit code instead of parsing error text.
- Templates over repetition: If the user sends similar emails more than twice, create a template.
- Tags for cross-cutting, folders for exclusive: An email can have multiple tags but belongs to one folder.