himalaya
CLI 通过 IMAP/SMTP 管理电子邮件。使用“喜马拉雅”从终端列出、阅读、编写、回复、转发、搜索和组织电子邮件。支持多个帐户和使用 MML(MIME 元语言)编写消息。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~himalayacURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~himalaya/file -o himalaya.md# Himalaya Email CLI Himalaya is a CLI email client that lets you manage emails from the terminal using IMAP, SMTP, Notmuch, or Sendmail backends. ## References - `references/configuration.md` (config file setup + IMAP/SMTP authentication) - `references/message-composition.md` (MML syntax for composing emails) ## Prerequisites 1. Himalaya CLI installed (`himalaya --version` to verify) 2. A configuration file at `~/.config/himalaya/config.toml` 3. IMAP/SMTP credentials configured (password stored securely) ## Configuration Setup Run the interactive wizard to set up an account: ```bash himalaya account configure ``` Or create `~/.config/himalaya/config.toml` manually: ```toml [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" ``` ## Common Operations ### List Folders ```bash himalaya folder list ``` ### List Emails List emails in INBOX (default): ```bash himalaya envelope list ``` List emails in a specific folder: ```bash himalaya envelope list --folder "Sent" ``` List with pagination: ```bash himalaya envelope list --page 1 --page-size 20 ``` ### Search Emails ```bash himalaya envelope list from john@example.com subject meeting ``` ### Read an Email Read email by ID (shows plain text): ```bash himalaya message read 42 ``` Export raw MIME: ```bash himalaya message export 42 --full ``` ### Reply to an Email Interactive reply (opens $EDITOR): ```bash himalaya message reply 42 ``` Reply-all: ```bash himalaya message reply 42 --all ``` ### Forward an Email ```bash himalaya message forward 42 ``` ### Write a New Email Interactive compose (opens $EDITOR): ```bash himalaya message write ``` Send directly using template: ```bash cat << 'EOF' | himalaya template send From: you@example.com To: recipient@example.com Subject: Test Message Hello from Himalaya! EOF ``` Or with headers flag: ```bash himalaya message write -H "To:recipient@example.com" -H "Subject:Test" "Message body here" ``` ### Move/Copy Emails Move to folder: ```bash himalaya message move 42 "Archive" ``` Copy to folder: ```bash himalaya message copy 42 "Important" ``` ### Delete an Email ```bash himalaya message delete 42 ``` ### Manage Flags Add flag: ```bash himalaya flag add 42 --flag seen ``` Remove flag: ```bash himalaya flag remove 42 --flag seen ``` ## Multiple Accounts List accounts: ```bash himalaya account list ``` Use a specific account: ```bash himalaya --account work envelope list ``` ## Attachments Save attachments from a message: ```bash himalaya attachment download 42 ``` Save to specific directory: ```bash himalaya attachment download 42 --dir ~/Downloads ``` ## Output Formats Most commands support `--output` for structured output: ```bash himalaya envelope list --output json himalaya envelope list --output plain ``` ## Debugging Enable debug logging: ```bash RUST_LOG=debug himalaya envelope list ``` Full trace with backtrace: ```bash RUST_LOG=trace RUST_BACKTRACE=1 himalaya envelope list ``` ## Tips - Use `himalaya --help` or `himalaya <command> --help` for detailed usage. - 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 `pass`, system keyring, or a command that outputs the password. --- ## 中文说明 # Himalaya Email CLI Himalaya 是一个 CLI 邮件客户端,可让你使用 IMAP、SMTP、Notmuch 或 Sendmail 后端从终端管理电子邮件。 ## 参考 - `references/configuration.md`(配置文件设置 + IMAP/SMTP 认证) - `references/message-composition.md`(用于撰写邮件的 MML 语法) ## 前提条件 1. 已安装 Himalaya CLI(用 `himalaya --version` 验证) 2. 在 `~/.config/himalaya/config.toml` 存在一个配置文件 3. 已配置 IMAP/SMTP 凭据(密码安全存储) ## 配置设置 运行交互式向导来设置账户: ```bash himalaya account configure ``` 或手动创建 `~/.config/himalaya/config.toml`: ```toml [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 folder list ``` ### 列出邮件 列出 INBOX 中的邮件(默认): ```bash himalaya envelope list ``` 列出指定文件夹中的邮件: ```bash himalaya envelope list --folder "Sent" ``` 分页列出: ```bash himalaya envelope list --page 1 --page-size 20 ``` ### 搜索邮件 ```bash himalaya envelope list from john@example.com subject meeting ``` ### 阅读邮件 按 ID 阅读邮件(显示纯文本): ```bash himalaya message read 42 ``` 导出原始 MIME: ```bash himalaya message export 42 --full ``` ### 回复邮件 交互式回复(打开 $EDITOR): ```bash himalaya message reply 42 ``` 回复全部: ```bash himalaya message reply 42 --all ``` ### 转发邮件 ```bash himalaya message forward 42 ``` ### 撰写新邮件 交互式撰写(打开 $EDITOR): ```bash himalaya message write ``` 使用模板直接发送: ```bash cat << 'EOF' | himalaya template send From: you@example.com To: recipient@example.com Subject: Test Message Hello from Himalaya! EOF ``` 或使用 headers 标志: ```bash himalaya message write -H "To:recipient@example.com" -H "Subject:Test" "Message body here" ``` ### 移动/复制邮件 移动到文件夹: ```bash himalaya message move 42 "Archive" ``` 复制到文件夹: ```bash himalaya message copy 42 "Important" ``` ### 删除邮件 ```bash himalaya message delete 42 ``` ### 管理标记 添加标记: ```bash himalaya flag add 42 --flag seen ``` 移除标记: ```bash himalaya flag remove 42 --flag seen ``` ## 多账户 列出账户: ```bash himalaya account list ``` 使用指定账户: ```bash himalaya --account work envelope list ``` ## 附件 保存邮件中的附件: ```bash himalaya attachment download 42 ``` 保存到指定目录: ```bash himalaya attachment download 42 --dir ~/Downloads ``` ## 输出格式 大多数命令支持 `--output` 以获得结构化输出: ```bash himalaya envelope list --output json himalaya envelope list --output plain ``` ## 调试 启用调试日志: ```bash RUST_LOG=debug himalaya envelope list ``` 带回溯的完整跟踪: ```bash RUST_LOG=trace RUST_BACKTRACE=1 himalaya envelope list ``` ## 提示 - 使用 `himalaya --help` 或 `himalaya <command> --help` 查看详细用法。 - 邮件 ID 是相对于当前文件夹的;切换文件夹后请重新列出。 - 若要撰写带附件的富文本邮件,请使用 MML 语法(参见 `references/message-composition.md`)。 - 使用 `pass`、系统密钥环或能输出密码的命令来安全地存储密码。