himalaya: Terminal Email for AI Agents — IMAP, SMTP, and MML Composition
With 10,600+ downloads and 316 installs — one of the highest install-to-download ratios on ClawHub — himalaya is the standard email skill for OpenClaw power users. It wraps Himalaya, a Rust-built CLI email client from the Pimalaya project with 5,700+ GitHub stars, into an OpenClaw skill that gives agents complete email management capabilities: read, compose, reply, forward, search, and organize, across multiple accounts, entirely from the terminal.
The Problem It Solves
Email automation usually means either a heavyweight browser-use approach (fragile, slow) or a narrow API wrapper tied to one provider (Gmail-only, Outlook-only). Neither works well for agents that need to manage email across multiple accounts, access emails from self-hosted mail servers, or handle complex MIME attachments.
Himalaya solves this with a backend-agnostic IMAP/SMTP implementation. Any email provider that supports standard protocols works: Gmail, Outlook, Fastmail, Protonmail Bridge, self-hosted Postfix, iCloud — configure once in TOML and your agent has full access.
Core Concept
Himalaya is a Rust CLI tool with excellent performance and standards compliance. The OpenClaw skill wraps it with:
- A
SKILL.mdthat teaches agents the right commands for each email task - Reference docs for configuration and MIME composition
- Standard OpenClaw installation (via
brew install himalaya)
Once configured, every email operation is a himalaya command.
Deep Dive
Configuration
# ~/.config/himalaya/config.toml
[accounts.personal]
email = "[email protected]"
display-name = "Your Name"
default = true
backend.type = "imap"
backend.host = "imap.example.com"
backend.port = 993
backend.encryption.type = "tls"
backend.login = "[email protected]"
backend.auth.type = "password"
backend.auth.cmd = "pass show email/imap" # reads from password-store
message.send.backend.type = "smtp"
message.send.backend.host = "smtp.example.com"
message.send.backend.port = 587
message.send.backend.encryption.type = "start-tls"
message.send.backend.login = "[email protected]"
message.send.backend.auth.type = "password"
message.send.backend.auth.cmd = "pass show email/smtp"The auth.cmd field is the key to secure password management: instead of storing passwords in plaintext config, it runs any shell command to retrieve the credential. Pass, keyring, Bitwarden CLI, 1Password CLI — all work here.
For interactive setup:
himalaya account configureReading Emails
# List inbox (default: 20 most recent)
himalaya envelope list
# Paginate
himalaya envelope list --page 1 --page-size 50
# List a specific folder
himalaya envelope list --folder "Sent"
himalaya envelope list --folder "Archive"
# Read a specific message (by ID from envelope list)
himalaya message read 42Search
himalaya envelope list --query "from:[email protected] subject:urgent"
himalaya envelope list --query "since:2026-01-01 before:2026-02-01"
himalaya envelope list --query "body:invoice"Search syntax follows IMAP search conventions. The --query flag supports complex boolean expressions for fine-grained filtering.
Composing and Sending
Himalaya uses MML (MIME Meta Language) for email composition — a human-readable format for specifying MIME structure:
From: [email protected]
To: [email protected]
Subject: Project update
Hi,
Here's the project update for this week.
<#part type=text/plain>
See the attached report.
</#part>
<#part type=application/pdf filename=report.pdf>
./report.pdf
</#part>
Send directly from a file:
himalaya message send --account personal < draft.emlOr use the template command:
himalaya template forward 42 # Generates forward template for message 42
himalaya template reply 42 # Generates reply templateEdit the template, then pipe to himalaya message send.
Reply and Forward Workflows
# Generate reply template for message ID 42
himalaya template reply 42 > reply.eml
# Edit the template (agent fills in the body)
# ...
# Send
himalaya message send < reply.emlThis pattern — template → fill → send — is how agents handle reply and forward without reinventing the MIME headers.
Organizing Mail
# Move message to folder
himalaya message move 42 Archive
# Copy message
himalaya message copy 42 "Important"
# Delete
himalaya message delete 42
# Flag as seen/unseen
himalaya flag add 42 seen
himalaya flag remove 42 seenMultiple Accounts
# Specify account explicitly
himalaya --account work envelope list
himalaya --account personal envelope list
# Default account (set in config) used when not specified
himalaya envelope listSetup
clawhub install himalayaInstall himalaya CLI:
brew install himalaya # macOS
# Or: pip install himalaya # via pip (if brew unavailable)Configure ~/.config/himalaya/config.toml with your IMAP/SMTP credentials.
Comparison: Email CLI Tools for Agents
| Tool | Backend Support | Composition Format | Agent-native | Multi-account |
|---|---|---|---|---|
| himalaya | IMAP/SMTP/Notmuch | MML | ✅ skill | ✅ |
| mutt/neomutt | IMAP/POP3/SMTP | RFC 2822 | ❌ | ✅ |
| aerc | IMAP/SMTP | plain text | ❌ | ✅ |
| Gmail API | Gmail only | JSON | ⚠️ | ⚠️ |
| Browser-use email | Any (browser) | UI interaction | ❌ | ✅ |
Himalaya's Rust implementation makes it reliably fast — envelope list on a 50,000 message inbox completes in under a second on a good IMAP connection.
Practical Tips
- Use
auth.cmdfor credentials — never store passwords in plaintext config; point to your password manager CLI - Set one account as
default = true— simplifies most commands; use--account nameonly when switching - Use
template replybefore writing — the generated template includes the correct headers (In-Reply-To, References) for proper threading; writing from scratch will break thread context - Pipe JSON output for agent processing — most commands support
--output jsonfor structured output - Search with
--queryfor task-specific views — instead of scrolling through inbox, search forsubject:invoiceorfrom:[email protected]to surface relevant emails directly
Considerations
- IMAP connection required: Himalaya connects live to your IMAP server on each command. Slow or unreliable IMAP servers will make the agent feel sluggish.
- MML learning curve: Composing emails with MML is unfamiliar compared to standard email clients. Agents need to learn the
<#part>syntax for attachments. - No OAuth UI flow: OAuth providers (Gmail, Outlook) require an initial browser-based authorization flow. This is a one-time setup but can't be automated — a human must complete it.
- Rate limits: Some providers (Gmail, Outlook) throttle aggressive IMAP polling. For monitoring use cases, consider using a dedicated email monitoring service rather than polling via himalaya.
The Bigger Picture
Email remains the backbone of business communication, and yet most AI agents treat it as an afterthought — relying on fragile browser automation or single-provider API wrappers. Himalaya's standards-based IMAP/SMTP implementation means an agent configured with this skill can manage email across any provider, with the same commands, the same reliability, and the same composable output format. For agents that need to read, triage, respond to, and organize email as part of their work, himalaya is the foundation.
View the skill on ClawHub: himalaya