
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": []
}
Himalaya manages your mail from the command line: every command prints JSON for scripts, frontends and agents, or plain text for a person.
Table of contents
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
Pre-built binary
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 binary from the GitHub releases section. For a build of master, check out the releases GitHub workflow and look for the Artifacts section.
Cargo
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
Run without a configuration at a terminal, Himalaya shows the commands copying the shipped sample in place. 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, one section per backend; rename the account and uncomment what you need.
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 an app password for IMAP and SMTP, or an OAuth 2.0 token from Ortie for the Gmail API, replacing both blocks. Special mailboxes live under [Gmail]/, so alias them.
[accounts.gmail]
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"
# gmail.auth.token.command = ["ortie", "token", "show", "-a", "gmail"]
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
Every command runs on the default account unless -a names another, prints JSON under --json, and details its flags, exit codes and output in its --help.
himalaya account check
himalaya envelope list --json
himalaya envelope search --sort newest-first from:alice date:2d
himalaya message read 42
himalaya message reply 42 --body "Thanks!" --send
himalaya flag add --flag seen 1 2 3
himalaya imap raw 'a1 NAMESPACE'
himalaya mcp --allow-write
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-server403
Gmail
PluginOpenAI 官方 Codex 插件,通过 Gmail 连接器搜索邮件、阅读会话、起草回复、整理收件箱。插件本身不带额外技能,需在 Codex 中授权 Google 账号。
openai/plugins8.4k
Spark CLI Skills
SkillSpark 邮箱官方技能合集:让 agent 查邮件、日历、联系人与团队,内置晨间简报、清空收件箱、会前准备、会后跟进、周报等流程和行政助理、销售、客服等角色;需在 macOS 或 Windows 登录 Spark 桌面版并开启 CLI,可按账户设只读、整理或可发信三档权限。
readdle/spark-cli-skills158
gws(Google Workspace CLI)
CLI用一个命令行调用 Gmail、Drive、日历、Docs、Sheets 等 Google Workspace API,命令按 Discovery 动态生成、输出 JSON,附 100 多个 Agent Skill。googleworkspace 组织开源但声明非官方支持产品;需 Google Cloud 项目 OAuth 授权。
googleworkspace/cli32.5k
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-plugins36.8k
