himalaya
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHimalaya Email CLI
Himalaya Email CLI
Himalaya is a CLI email client that lets you manage emails from the terminal using IMAP, SMTP, Notmuch, or Sendmail backends.
This skill is separate from the Hermes Email gateway adapter. The gateway
adapter lets people email the agent and uses Hermes' built-in IMAP/SMTP
adapter; this skill lets the agent operate a mailbox from terminal tools and
requires the external CLI.
himalayaHimalaya 是一款CLI邮件客户端,可让你通过终端使用IMAP、SMTP、Notmuch或Sendmail后端管理邮件。
本技能独立于Hermes邮件网关适配器。网关适配器支持用户向Agent发送邮件,并使用Hermes内置的IMAP/SMTP适配器;而本技能则让Agent通过终端工具操作邮箱,需要外部的 CLI工具。
himalayaReferences
参考资料
- (config file setup + IMAP/SMTP authentication)
references/configuration.md - (MML syntax for composing emails)
references/message-composition.md
- (配置文件设置 + IMAP/SMTP认证)
references/configuration.md - (用于撰写邮件的MML语法)
references/message-composition.md
Prerequisites
前置条件
- Himalaya CLI installed (to verify)
himalaya --version - A configuration file at
~/.config/himalaya/config.toml - IMAP/SMTP credentials configured (password stored securely)
- 已安装Himalaya CLI(可通过验证)
himalaya --version - 在路径下存在配置文件
~/.config/himalaya/config.toml - 已配置IMAP/SMTP凭据(密码需安全存储)
Installation
安装方式
bash
undefinedbash
undefinedPre-built binary (Linux/macOS — recommended)
预编译二进制包(Linux/macOS — 推荐)
curl -sSL https://raw.githubusercontent.com/pimalaya/himalaya/master/install.sh | PREFIX=~/.local sh
curl -sSL https://raw.githubusercontent.com/pimalaya/himalaya/master/install.sh | PREFIX=~/.local sh
macOS via Homebrew
macOS 可通过Homebrew安装
brew install himalaya
brew install himalaya
Or via cargo (any platform with Rust)
或通过cargo安装(任何支持Rust的平台)
cargo install himalaya --locked
undefinedcargo install himalaya --locked
undefinedConfiguration Setup
配置设置
Run the interactive wizard to set up an account:
bash
himalaya account configureOr create manually:
~/.config/himalaya/config.tomltoml
[accounts.personal]
email = "you@example.com"
display-name = "Your Name"
default = true
backend.type = "imap"
backend.host = "imap.example.com"
backend.port = 993
backend.encryption.type = "tls"
backend.login = "you@example.com"
backend.auth.type = "password"
backend.auth.cmd = "pass show email/imap" # or use keyring
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 = "you@example.com"
message.send.backend.auth.type = "password"
message.send.backend.auth.cmd = "pass show email/smtp"运行交互式向导来设置账户:
bash
himalaya account configure或手动创建文件:
~/.config/himalaya/config.tomltoml
[accounts.personal]
email = "you@example.com"
display-name = "Your Name"
default = true
backend.type = "imap"
backend.host = "imap.example.com"
backend.port = 993
backend.encryption.type = "tls"
backend.login = "you@example.com"
backend.auth.type = "password"
backend.auth.cmd = "pass show email/imap" # 或使用密钥环
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 = "you@example.com"
message.send.backend.auth.type = "password"
message.send.backend.auth.cmd = "pass show email/smtp"Folder aliases (himalaya v1.2.0+ syntax). Required whenever the
文件夹别名(himalaya v1.2.0+ 语法)。当服务器的文件夹名称与himalaya的标准名称(inbox/sent/drafts/trash)不匹配时,必须设置别名
server's folder names don't match himalaya's canonical names
Gmail是常见情况 — 查看references/configuration.md
了解[Gmail]/Sent Mail
的映射方式。
references/configuration.md[Gmail]/Sent Mail(inbox/sent/drafts/trash). Gmail is the common case — see
—
references/configuration.md
for the [Gmail]/Sent Mail
mapping.
references/configuration.md[Gmail]/Sent Mail—
folder.aliases.inbox = "INBOX"
folder.aliases.sent = "Sent"
folder.aliases.drafts = "Drafts"
folder.aliases.trash = "Trash"
> **Heads up on the alias syntax.** Pre-v1.2.0 docs used a
> `[accounts.NAME.folder.alias]` sub-section (singular `alias`).
> v1.2.0 silently ignores that form — TOML parses fine, but the
> alias resolver never reads it, so every lookup falls through to
> the canonical name. On Gmail this means save-to-Sent fails *after*
> SMTP delivery succeeds, and `himalaya message send` exits non-zero.
> Any caller (agent, script, user) that retries on that exit code
> will re-run the entire send — including SMTP — producing duplicate
> emails to recipients. Always use `folder.aliases.X` (plural, dotted
> keys, directly under `[accounts.NAME]`).folder.aliases.inbox = "INBOX"
folder.aliases.sent = "Sent"
folder.aliases.drafts = "Drafts"
folder.aliases.trash = "Trash"
> **别名语法注意事项**。v1.2.0之前的文档使用`[accounts.NAME.folder.alias]`子节(单数`alias`)。
> v1.2.0会静默忽略该格式 — TOML解析正常,但别名解析器不会读取它,因此所有查找都会使用标准名称。在Gmail上,这意味着SMTP投递成功后,保存到已发送文件夹会失败,且`himalaya message send`会返回非零退出码。
> 任何调用者(Agent、脚本、用户)如果根据该退出码重试,会重新执行整个发送流程 — 包括SMTP — 导致收件人收到重复邮件。请务必使用`folder.aliases.X`(复数,点式键,直接位于`[accounts.NAME]`下)。Hermes Integration Notes
Hermes集成说明
- Reading, listing, searching, moving, deleting all work directly through the terminal tool
- Composing/replying/forwarding — piped input () is recommended for reliability. Interactive
cat << EOF | himalaya template sendmode works with$EDITOR+ background + process tool, but requires knowing the editor and its commandspty=true - Use for structured output that's easier to parse programmatically
--output json - The wizard requires interactive input — use PTY mode:
himalaya account configureterminal(command="himalaya account configure", pty=true)
- 读取、列出、搜索、移动、删除操作均可直接通过终端工具完成
- 撰写/回复/转发 — 推荐使用管道输入()以保证可靠性。交互式
cat << EOF | himalaya template send模式可配合$EDITOR+ 后台 + 进程工具使用,但需要了解编辑器及其命令pty=true - 使用获取结构化输出,便于程序化解析
--output json - 向导需要交互式输入 — 使用PTY模式:
himalaya account configureterminal(command="himalaya account configure", pty=true)
Common Operations
常见操作
List Folders
列出文件夹
bash
himalaya folder listbash
himalaya folder listList Emails
列出邮件
List emails in INBOX (default):
bash
himalaya envelope listList emails in a specific folder:
bash
himalaya envelope list --folder "Sent"List with pagination:
bash
himalaya envelope list --page 1 --page-size 20列出收件箱中的邮件(默认):
bash
himalaya envelope list列出特定文件夹中的邮件:
bash
himalaya envelope list --folder "Sent"分页列出邮件:
bash
himalaya envelope list --page 1 --page-size 20Search Emails
搜索邮件
bash
himalaya envelope list from john@example.com subject meetingbash
himalaya envelope list from john@example.com subject meetingRead an Email
读取邮件
Read email by ID (shows plain text):
bash
himalaya message read 42Export raw MIME:
bash
himalaya message export 42 --full通过ID读取邮件(显示纯文本):
bash
himalaya message read 42导出原始MIME格式:
bash
himalaya message export 42 --fullReply to an Email
回复邮件
To reply non-interactively from Hermes, read the original message, compose a reply, and pipe it:
bash
undefined要从Hermes非交互式回复邮件,需先读取原始邮件,撰写回复内容后通过管道发送:
bash
undefinedGet the reply template, edit it, and send
获取回复模板,编辑后发送
himalaya template reply 42 | sed 's/^$/\nYour reply text here\n/' | himalaya template send
Or build the reply manually:
```bash
cat << 'EOF' | himalaya template send
From: you@example.com
To: sender@example.com
Subject: Re: Original Subject
In-Reply-To: <original-message-id>
Your reply here.
EOFReply-all (interactive — needs $EDITOR, use template approach above instead):
bash
himalaya message reply 42 --allhimalaya template reply 42 | sed 's/^$/\n你的回复内容\n/' | himalaya template send
或手动构建回复:
```bash
cat << 'EOF' | himalaya template send
From: you@example.com
To: sender@example.com
Subject: Re: Original Subject
In-Reply-To: <original-message-id>
你的回复内容。
EOF回复所有人(交互式 — 需要$EDITOR,建议使用上述模板方式):
bash
himalaya message reply 42 --allForward an Email
转发邮件
bash
undefinedbash
undefinedGet forward template and pipe with modifications
获取转发模板并修改后通过管道发送
himalaya template forward 42 | sed 's/^To:.*/To: newrecipient@example.com/' | himalaya template send
undefinedhimalaya template forward 42 | sed 's/^To:.*/To: newrecipient@example.com/' | himalaya template send
undefinedWrite a New Email
撰写新邮件
Non-interactive (use this from Hermes) — pipe the message via stdin:
bash
cat << 'EOF' | himalaya template send
From: you@example.com
To: recipient@example.com
Subject: Test Message
Hello from Himalaya!
EOFOr with headers flag:
bash
himalaya message write -H "To:recipient@example.com" -H "Subject:Test" "Message body here"Note: without piped input opens . This works with + background mode, but piping is simpler and more reliable.
himalaya message write$EDITORpty=true非交互式(推荐在Hermes中使用) — 通过标准输入管道传递邮件内容:
bash
cat << 'EOF' | himalaya template send
From: you@example.com
To: recipient@example.com
Subject: Test Message
来自Himalaya的问候!
EOF或使用头部参数:
bash
himalaya message write -H "To:recipient@example.com" -H "Subject:Test" "邮件正文内容"注意:不带管道输入的会打开。该方式可配合 + 后台模式使用,但管道方式更简单可靠。
himalaya message write$EDITORpty=trueMove/Copy Emails
移动/复制邮件
Move to folder:
bash
himalaya message move 42 "Archive"Copy to folder:
bash
himalaya message copy 42 "Important"移动到指定文件夹:
bash
himalaya message move 42 "Archive"复制到指定文件夹:
bash
himalaya message copy 42 "Important"Delete an Email
删除邮件
bash
himalaya message delete 42bash
himalaya message delete 42Manage Flags
管理标记
Add flag:
bash
himalaya flag add 42 --flag seenRemove flag:
bash
himalaya flag remove 42 --flag seen添加标记:
bash
himalaya flag add 42 --flag seen移除标记:
bash
himalaya flag remove 42 --flag seenMultiple Accounts
多账户管理
List accounts:
bash
himalaya account listUse a specific account:
bash
himalaya --account work envelope list列出账户:
bash
himalaya account list使用指定账户:
bash
himalaya --account work envelope listAttachments
附件管理
Save attachments from a message:
bash
himalaya attachment download 42Save to specific directory:
bash
himalaya attachment download 42 --dir ~/Downloads保存邮件中的附件:
bash
himalaya attachment download 42保存到指定目录:
bash
himalaya attachment download 42 --dir ~/DownloadsOutput Formats
输出格式
Most commands support for structured output:
--outputbash
himalaya envelope list --output json
himalaya envelope list --output plain大多数命令支持参数以获取结构化输出:
--outputbash
himalaya envelope list --output json
himalaya envelope list --output plainDebugging
调试
Enable debug logging:
bash
RUST_LOG=debug himalaya envelope listFull trace with backtrace:
bash
RUST_LOG=trace RUST_BACKTRACE=1 himalaya envelope list启用调试日志:
bash
RUST_LOG=debug himalaya envelope list带回溯的完整跟踪:
bash
RUST_LOG=trace RUST_BACKTRACE=1 himalaya envelope listTips
小贴士
- Use or
himalaya --helpfor detailed usage.himalaya <command> --help - Message IDs are relative to the current folder; re-list after folder changes.
- For composing rich emails with attachments, use MML syntax (see ).
references/message-composition.md - Store passwords securely using , system keyring, or a command that outputs the password.
pass
- 使用或
himalaya --help查看详细用法。himalaya <command> --help - 邮件ID是相对于当前文件夹的;切换文件夹后需重新列出邮件。
- 如需撰写带附件的富文本邮件,请使用MML语法(查看)。
references/message-composition.md - 使用、系统密钥环或可输出密码的命令来安全存储密码。
pass