
Himalaya
CLI命令行邮件客户端,支持 IMAP、SMTP、JMAP、Gmail 与 Microsoft Graph,多账户、可用 --json 输出,适合让 agent 查收、搜索、撰写与发送邮件;首次运行时向导会自动探测邮箱配置。
$ himalaya envelope search --json --sort newest-first from:alice date:2026-11-02..
{
"envelopes": [
{
"id": "2",
"messageId": "slides@example.org",
"inReplyTo": [],
"flags": [],
"subject": "Slides for the review",
"from": [{ "name": "Alice", "email": "alice@example.org" }],
"to": [{ "name": null, "email": "me@example.org" }],
"date": "2026-11-19T09:15:00+01:00",
"size": 355,
"hasAttachment": true
},
{
"id": "1",
"messageId": "lunch@example.org",
"inReplyTo": [],
"flags": [{ "raw": "\\Seen", "iana": "seen" }],
"subject": "Lunch on Friday?",
"from": [{ "name": "Alice", "email": "alice@example.org" }],
"to": [{ "name": null, "email": "me@example.org" }],
"date": "2026-11-18T12:30:00+01:00",
"size": 162,
"hasAttachment": false
}
],
"nextPage": null,
"total": null,
"errors": []
}
Table of contents
- Features
- Installation
- Configuration
- Usage
- Alternatives
- AI policy
- License
- Social
- Contributing
- Sponsoring
Features
- JSON output of every command, described by
himalaya json-schema, for scripts, frontends and agents - Unified API for mailboxes, envelopes, flags, messages and attachments, the same on every backend
- Protocol-specific APIs exposing the full surface of IMAP, SMTP, ManageSieve, JMAP, Gmail and Microsoft Graph
- Local stores: Maildir, mbox and pimdir, the offline store Neverest syncs
- One query language to search envelopes, whatever the backend
- REPL and MCP server running commands over connections kept for the session
- TOML configuration with several accounts, secrets read from any password manager
- Plain text output for a person: one item per line, no border, no colour
Installation
Debian, Ubuntu
Himalaya is not in the official repositories yet, but the signed APT repository of pkg.pimalaya.org ships the latest release with its man pages and shell completions. Add the repository once:
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://pkg.pimalaya.org/pimalaya.asc | sudo tee /etc/apt/keyrings/pimalaya.asc >/dev/null
sudo tee /etc/apt/sources.list.d/pimalaya.sources >/dev/null <<EOF
Types: deb
URIs: https://pkg.pimalaya.org/apt
Suites: stable
Components: main
Signed-By: /etc/apt/keyrings/pimalaya.asc
EOF
sudo apt update
Then install Himalaya:
sudo apt install himalaya
Fedora, RHEL, Rocky Linux, AlmaLinux
Himalaya is not in the official repositories yet, but the signed DNF repository of pkg.pimalaya.org ships the latest release with its man pages and shell completions:
sudo curl -fsSL -o /etc/yum.repos.d/pimalaya.repo https://pkg.pimalaya.org/pimalaya.repo
sudo dnf install himalaya
Homebrew (macOS, Linux)
brew install himalaya
Pre-built binary
For other systems, Himalaya can be installed with the installer:
As root:
curl -sSL https://raw.githubusercontent.com/pimalaya/himalaya/master/install.sh | sudo sh
As a regular user:
curl -sSL https://raw.githubusercontent.com/pimalaya/himalaya/master/install.sh | PREFIX=~/.local sh
These commands install the latest release, built with the default cargo features. For a build of master, check out the releases GitHub workflow and look for the Artifacts section.
Cargo
cargo install --locked himalaya
For a build of master:
cargo install --locked --git https://github.com/pimalaya/himalaya.git
Nix
nix profile install github:pimalaya/himalaya
Sources
Requires Rust 1.89 or later:
git clone https://github.com/pimalaya/himalaya
cd himalaya
cargo build --release --locked
The binary lands at target/release/himalaya.
Configuration
A TOML configuration is loaded from every existing path among the following, each one deep-merged on top of the ones before:
$XDG_CONFIG_HOME/himalaya/config.toml$HOME/.config/himalaya/config.toml$HOME/.himalayarc
Override the path with -c <PATH>, repeated to merge several files. The same file backs himalaya-tui, its own keys under [tui].
[!TIP] See config.sample.toml for a complete configuration of one example account with commented fields; rename the account and uncomment what you need, or start from a provider below.
Proton Mail
Run Proton Bridge, which serves Proton on a local IMAP and SMTP endpoint; the password is the one the Bridge generates, not your account's.
[accounts.proton]
imap.server = "imap://127.0.0.1:1143"
imap.sasl.plain.username = "example@proton.me"
imap.sasl.plain.password.command = "pass show proton-bridge"
smtp.server = "smtp://127.0.0.1:1025"
smtp.sasl.plain.username = "example@proton.me"
smtp.sasl.plain.password.command = "pass show proton-bridge"
Fastmail
Use an app password for IMAP and SMTP, or an API token for JMAP, replacing both blocks.
[accounts.fastmail]
imap.server = "imaps://imap.fastmail.com"
imap.sasl.plain.username = "example@fastmail.com"
imap.sasl.plain.password.command = "pass show fastmail"
smtp.server = "smtps://smtp.fastmail.com"
smtp.sasl.plain.username = "example@fastmail.com"
smtp.sasl.plain.password.command = "pass show fastmail"
# jmap.server = "https://api.fastmail.com/jmap/session"
# jmap.auth.bearer.token.command = "pass show fastmail"
Gmail
Use the Gmail API with an OAuth 2.0 token from Ortie's Google account.
[accounts.gmail]
gmail.auth.token.command = ["ortie", "token", "show", "-a", "google"]
Or IMAP and SMTP, with an app password or the same Ortie token over xoauth2 (in place of plain, as for Outlook below). Special mailboxes live under [Gmail]/, so alias them.
[accounts.gmail-imap]
imap.server = "imaps://imap.gmail.com:993"
imap.sasl.plain.username = "example@gmail.com"
imap.sasl.plain.password.command = "pass show gmail"
smtp.server = "smtps://smtp.gmail.com:465"
smtp.sasl.plain.username = "example@gmail.com"
smtp.sasl.plain.password.command = "pass show gmail"
mailbox.alias.sent = "[Gmail]/Sent Mail"
mailbox.alias.drafts = "[Gmail]/Drafts"
mailbox.alias.trash = "[Gmail]/Trash"
mailbox.alias.archive = "[Gmail]/All Mail"
# imap.sasl.xoauth2.username = "example@gmail.com"
# imap.sasl.xoauth2.token.command = ["ortie", "token", "show", "-a", "google"]
# smtp.sasl.xoauth2.username = "example@gmail.com"
# smtp.sasl.xoauth2.token.command = ["ortie", "token", "show", "-a", "google"]
Outlook
Microsoft refuses passwords: use xoauth2 with a token from Ortie, or the Microsoft Graph API, replacing both blocks.
[accounts.outlook]
imap.server = "imaps://outlook.office365.com:993"
imap.sasl.xoauth2.username = "example@outlook.com"
imap.sasl.xoauth2.token.command = ["ortie", "token", "show", "-a", "outlook"]
smtp.server = "smtp://smtp-mail.outlook.com:587"
smtp.starttls = true
smtp.sasl.xoauth2.username = "example@outlook.com"
smtp.sasl.xoauth2.token.command = ["ortie", "token", "show", "-a", "outlook"]
# msgraph.auth.token.command = ["ortie", "token", "show", "-a", "msgraph"]
Posteo
Standard IMAP and SMTP with the account password.
[accounts.posteo]
imap.server = "imaps://posteo.de"
imap.sasl.plain.username = "example@posteo.net"
imap.sasl.plain.password.command = "pass show posteo"
smtp.server = "smtps://posteo.de"
smtp.sasl.plain.username = "example@posteo.net"
smtp.sasl.plain.password.command = "pass show posteo"
iCloud Mail
Use an app-specific password; the IMAP login is the address's name, the SMTP login the full address.
[accounts.icloud]
imap.server = "imaps://imap.mail.me.com:993"
imap.sasl.plain.username = "johnappleseed"
imap.sasl.plain.password.command = "pass show icloud"
smtp.server = "smtp://smtp.mail.me.com:587"
smtp.starttls = true
smtp.sasl.plain.username = "johnappleseed@icloud.com"
smtp.sasl.plain.password.command = "pass show icloud"
mailbox.alias.sent = "Sent Messages"
Usage
Step 1: once your first account is configured, check that every backend answers:
himalaya account check
Step 2: list the envelopes of the inbox:
himalaya envelope list
Step 3: read a message by its id:
himalaya message read 42
Every command runs on the default account unless -a names another, and its --help details its flags, exit codes and JSON output. More use cases:
# Search the newest messages from Alice of the last two days
himalaya envelope search --sort newest-first from:alice date:2d
# Reply and send at once
himalaya message reply 42 --body "Thanks!" --send
# Mark messages as seen
himalaya flag add --flag seen 1 2 3
# Send a raw IMAP command
himalaya imap raw 'a1 NAMESPACE'
# Serve the account to an AI agent, writes allowed
himalaya mcp --allow-write
Alternatives
- NeoMutt: a terminal mail client, driven from its own interface rather than scripted
- aerc: a terminal mail client for IMAP, JMAP, Maildir and notmuch
- mblaze: Unix utilities over a Maildir, local mail only
- gog: a Google Workspace CLI with JSON output, Gmail only for mail
License
This project is licensed under either of:
Social
- Chat on Matrix
- News on Mastodon or RSS
- Mail at pimalaya.org@posteo.net
Sponsoring
Special thanks to the NLnet foundation and the European Commission that have been financially supporting the project for years:
- 2022 → 2023: NGI Assure
- 2023 → 2024: NGI Zero Entrust
- 2024 → 2026: NGI Zero Core
- 2026 → 2027: NGI Zero Commons Fund
This program is part of Pimalaya, free software funded entirely by grants and donations. If you find it useful, consider sponsoring its development:
相关资源

mcp-email-server
MCP通过 IMAP/SMTP 让 agent 读取、搜索、整理和发送邮件,任何支持这两种协议的邮箱都能接入,支持多个账号,自带本地网页配置界面。需要邮箱账号的密码或授权码。
Wh1isper/mcp-email-server413
Gmail
PluginOpenAI 官方 Codex 插件,通过 Gmail 连接器搜索邮件、阅读会话、起草回复、整理收件箱。插件本身不带额外技能,需在 Codex 中授权 Google 账号。
openai/plugins8.5k
Spark CLI Skills
SkillSpark 邮箱官方技能合集:让 agent 查邮件、日历、联系人与团队,内置晨间简报、清空收件箱、会前准备、会后跟进、周报等流程和行政助理、销售、客服等角色;需在 macOS 或 Windows 登录 Spark 桌面版并开启 CLI,可按账户设只读、整理或可发信三档权限。
readdle/spark-cli-skills160
gws(Google Workspace CLI)
CLI用一个命令行调用 Gmail、Drive、日历、Docs、Sheets 等 Google Workspace API,命令按 Discovery 动态生成、输出 JSON,附 100 多个 Agent Skill。googleworkspace 组织开源但声明非官方支持产品;需 Google Cloud 项目 OAuth 授权。
googleworkspace/cli32.6k
gog (gogcli)
CLI面向脚本与 agent 的 Google Workspace 命令行,覆盖 Gmail、日历、Drive、Docs、Sheets、联系人与任务,支持 JSON 输出、只读模式与命令白名单,可作只读默认的 MCP 服务;需自备 Google OAuth 客户端。
openclaw/gogcli8.6k
Enterprise Search
PluginAnthropic 官方知识工作插件:一次提问同时检索已接入的聊天、邮件、云盘文档、Wiki 与项目管理工具,汇总成带出处的答案,并能生成每日或每周动态摘要。预置 Slack、Notion、Atlassian、Asana 等 MCP 连接,需逐个授权。
anthropics/knowledge-work-plugins37.5k
