himalaya

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Himalaya Email Workflows

Himalaya 邮件工作流

CLI email client for IMAP/Maildir/Notmuch backends.
一款支持IMAP/Maildir/Notmuch后端的CLI邮件客户端。

Command Structure

命令结构

All commands follow:
himalaya <resource> <action>
ResourceActions
envelope
list
,
thread
message
read
,
write
,
reply
,
forward
,
copy
,
move
,
delete
folder
list
,
add
,
delete
,
purge
,
expunge
flag
add
,
set
,
remove
attachment
download
template
write
,
reply
,
forward
,
save
,
send
所有命令遵循格式:
himalaya <资源> <操作>
资源操作
envelope
list
,
thread
message
read
,
write
,
reply
,
forward
,
copy
,
move
,
delete
folder
list
,
add
,
delete
,
purge
,
expunge
flag
add
,
set
,
remove
attachment
download
template
write
,
reply
,
forward
,
save
,
send

Quick Reference

快速参考

Inbox Triage

收件箱分类处理

Important: Flags must come BEFORE the query filter (if any).
fish
undefined
重要提示: 标记参数必须在查询过滤器(如果有)之前。
fish
undefined

List unread/new messages (use --output json for cleaner parsing)

列出未读/新邮件(使用--output json以便更清晰地解析)

himalaya envelope list --output json 'not flag Seen'
himalaya envelope list --output json 'not flag Seen'

List all envelopes (default: INBOX)

列出所有信封(默认:收件箱)

himalaya envelope list --output json
himalaya envelope list --output json

List with specific folder and page

指定文件夹和页码列出

himalaya envelope list -f Archive -p 2
himalaya envelope list -f Archive -p 2

Read message by ID

通过ID读取邮件

himalaya message read 123
himalaya message read 123

Mark as seen

标记为已读

himalaya flag add 123 seen
himalaya flag add 123 seen

Move to folder (TARGET first, then ID)

移动邮件到文件夹(目标文件夹在前,ID在后)

himalaya message move Archive 123
undefined
himalaya message move Archive 123
undefined

Searching (Query DSL)

搜索(查询DSL)

Himalaya uses its own query DSL, NOT IMAP SEARCH syntax:
fish
undefined
Himalaya使用自有查询DSL,而非IMAP搜索语法:
fish
undefined

Filter by date

按日期过滤

himalaya envelope list after 2025-01-01 himalaya envelope list before 2025-01-15 himalaya envelope list date 2025-01-10
himalaya envelope list after 2025-01-01 himalaya envelope list before 2025-01-15 himalaya envelope list date 2025-01-10

Filter by sender/recipient

按发件人/收件人过滤

himalaya envelope list from boss@company.com himalaya envelope list to team@company.com
himalaya envelope list from boss@company.com himalaya envelope list to team@company.com

Filter by content

按内容过滤

himalaya envelope list subject urgent himalaya envelope list body "project update"
himalaya envelope list subject urgent himalaya envelope list body "project update"

Filter by flag (use 'not flag Seen' for unread)

按标记过滤(使用'not flag Seen'筛选未读邮件)

himalaya envelope list 'not flag Seen' himalaya envelope list flag flagged
himalaya envelope list 'not flag Seen' himalaya envelope list flag flagged

Combine with operators

使用操作符组合条件

himalaya envelope list from boss@company.com and subject urgent himalaya envelope list "from alice or from bob" himalaya envelope list not flag seen
himalaya envelope list from boss@company.com and subject urgent himalaya envelope list "from alice or from bob" himalaya envelope list not flag seen

Sort results

对结果排序

himalaya envelope list order by date desc himalaya envelope list subject report order by from asc
undefined
himalaya envelope list order by date desc himalaya envelope list subject report order by from asc
undefined

Composing

撰写邮件

fish
undefined
fish
undefined

New message (opens $EDITOR)

新建邮件(打开$EDITOR编辑器)

himalaya message write
himalaya message write

Reply / Reply-all

回复/全部回复

himalaya message reply 123 himalaya message reply 123 --all
himalaya message reply 123 himalaya message reply 123 --all

Forward

转发邮件

himalaya message forward 456
undefined
himalaya message forward 456
undefined

Attachments (MML Syntax)

附件(MML语法)

Attachments use MML in the message body, not command-line flags:
To: recipient@example.com
Subject: Files attached

Here is the document.

<#part filename=/path/to/file.pdf><#/part>

Inline image:
<#part disposition=inline filename=/path/to/image.png><#/part>
附件需在邮件正文中使用MML语法,而非命令行参数:
To: recipient@example.com
Subject: Files attached

Here is the document.

<#part filename=/path/to/file.pdf><#/part>

Inline image:
<#part disposition=inline filename=/path/to/image.png><#/part>

Organizing

邮件整理

fish
undefined
fish
undefined

List folders

列出文件夹

himalaya folder list
himalaya folder list

Move message(s) - TARGET folder comes first, then IDs

移动邮件 - 目标文件夹在前,ID在后

himalaya message move Archive 123 456
himalaya message move Archive 123 456

Copy message(s) - TARGET folder comes first, then IDs

复制邮件 - 目标文件夹在前,ID在后

himalaya message copy Backup 123
himalaya message copy Backup 123

Delete (marks as deleted)

删除邮件(标记为已删除)

himalaya message delete 123
himalaya message delete 123

Expunge (permanent delete)

彻底删除(永久删除)

himalaya folder expunge INBOX
undefined
himalaya folder expunge INBOX
undefined

Scripting

脚本编写

fish
undefined
fish
undefined

JSON output for parsing

输出JSON格式以便解析

himalaya envelope list --output json himalaya envelope list --output json | jq '.[].id'
himalaya envelope list --output json himalaya envelope list --output json | jq '.[].id'

Specific account

指定账户

himalaya envelope list -a work
himalaya envelope list -a work

Combine for automation

组合命令实现自动化

himalaya envelope list --output json 'not flag Seen' | jq -r '.[].id' | while read id himalaya message read $id end
undefined
himalaya envelope list --output json 'not flag Seen' | jq -r '.[].id' | while read id himalaya message read $id end
undefined

Common Flags

常用参数

FlagDescription
-a, --account <NAME>
Use specific account
-f, --folder <NAME>
Target folder (default: INBOX)
-o, --output <FORMAT>
plain
or
json
(prefer
json
for scripting/AI parsing)
-p, --page <N>
Page number (starts at 1)
-s, --page-size <N>
Results per page
Note: Always use
--output json
when parsing output programmatically. Plain output includes WARN log messages that interfere with parsing. Flags must come BEFORE any query filter.
参数描述
-a, --account <NAME>
使用指定账户
-f, --folder <NAME>
目标文件夹(默认:收件箱)
-o, --output <FORMAT>
plain
json
(脚本/AI解析优先使用
json
-p, --page <N>
页码(从1开始)
-s, --page-size <N>
每页结果数量
注意: 以编程方式解析输出时,请始终使用
--output json
。纯文本输出包含会干扰解析的WARN日志信息。参数必须在任何查询过滤器之前。

Templates (Non-Interactive)

模板(非交互式)

Generate messages without opening
$EDITOR
:
fish
undefined
无需打开
$EDITOR
即可生成邮件:
fish
undefined

Generate template (stdout)

生成模板(输出到标准输出)

himalaya template write himalaya template reply 123 himalaya template forward 456
himalaya template write himalaya template reply 123 himalaya template forward 456

Pipe and send

通过管道发送邮件

echo "To: x@y.com\nSubject: Hi\n\nHello" | himalaya template send
undefined
echo "To: x@y.com\nSubject: Hi\n\nHello" | himalaya template send
undefined

Common Mistakes

常见错误

WrongRightWhy
himalaya list
himalaya envelope list
Need resource prefix
himalaya read 123
himalaya message read 123
Need resource prefix
himalaya write -a file.pdf
MML
<#part>
in body
No
-a
flag exists
--query "FROM x"
from x
Himalaya DSL, not IMAP
himalaya search ...
himalaya envelope list ...
No
search
command
himalaya envelope list 'query' -o json
himalaya envelope list --output json 'query'
Flags must come before query
himalaya message move 123 Folder
himalaya message move Folder 123
Target folder comes first
错误用法正确用法原因
himalaya list
himalaya envelope list
需要添加资源前缀
himalaya read 123
himalaya message read 123
需要添加资源前缀
himalaya write -a file.pdf
在正文中使用MML
<#part>
不存在
-a
参数
--query "FROM x"
from x
使用Himalaya DSL,而非IMAP语法
himalaya search ...
himalaya envelope list ...
没有
search
命令
himalaya envelope list 'query' -o json
himalaya envelope list --output json 'query'
参数必须在查询之前
himalaya message move 123 Folder
himalaya message move Folder 123
目标文件夹需放在前面