
Feishu Cli Mail
- 405 installs
- 1.3k repo stars
- Updated July 31, 2026
- riba2534/feishu-cli
feishu-cli-mail is a Claude Code skill that automates Feishu and Lark Mail inbox triage, sending, replies, forwards, drafts, threads, and signatures through the feishu-cli terminal client.
About
feishu-cli-mail is a Claude Code skill for Feishu/Lark Mail operations via the feishu-cli command line. After feishu-cli auth login supplies a User Access Token, agents run subcommands such as triage, send, reply, forward, draft-create, message, thread, signature, and template. Send, draft-create, draft-edit, reply, and reply-all accept plain text or HTML bodies with --html, and send can auto-scan CID inline images; forward currently supports plain text only and regular attachments are not supported in the first release. Developers reach for feishu-cli-mail when building bots, scripts, or agent tooling that must read, filter, or send workplace email from the terminal.
- Terminal access to Feishu mail APIs
- Scriptable send and read workflows
- Fits agent and automation pipelines
- Reduces manual inbox operations
- Pairs with other feishu-cli modules
Feishu Cli Mail by the numbers
- 405 all-time installs (skills.sh)
- +19 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #137 of 550 CLI & Terminal skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/riba2534/feishu-cli --skill feishu-cli-mailAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 405 |
|---|---|
| repo stars | ★ 1.3k |
| Last updated | July 31, 2026 |
| Repository | riba2534/feishu-cli ↗ |
How do you automate Feishu mail from the terminal?
Automate Feishu/Lark mail workflows from the terminal—list, read, send, or manage messages when building bots, scripts, or agent tools tied to workplace comms.
Who is it for?
Developers building Feishu/Lark bots, scripts, or agent tools that must send or triage workplace email from Bash.
Skip if: Teams that need regular file attachments or rich forward bodies before feishu-cli mail forward gains HTML support.
When should I use this skill?
The user asks to send, read, reply, forward, draft, filter, or sign Feishu or Lark mail from the CLI.
What you get
Sent or drafted Feishu emails, triaged inbox threads, replies, forwards, and updated mailbox signatures via CLI output.
- sent or drafted Feishu emails
- triaged inbox threads
- CLI mail command output
By the numbers
- Documents 9 mail subcommand areas: triage, send, reply, forward, draft-create, message, thread, signature, template
- Forward subcommand limited to plain text body in the first release
Files
飞书邮箱(Mail)
查看、发送、回复、转发邮件,管理草稿,过滤收件箱。
首期限制:
- body 类型:send / draft-create / draft-edit / reply / reply-all支持纯文本/HTML body(有--html/--plain-text控制位);forward当前仅支持纯文本 body(无--html/--plain-textflag)。
- CID 内联图片自动扫描(`--inline-images-auto-scan`):仅 `mail send` 支持。draft-create / draft-edit / reply / reply-all / forward暂未支持此 flag,需要内嵌图请走mail send。
- 普通附件:所有发送命令均暂不支持。
前置条件
- 认证:所有 mail 命令都需要 User Access Token(执行
feishu-cli auth login登录) - 预检:
feishu-cli auth check --scope "mail:user_mailbox:readonly"可验证 scope
命令速查
查询类命令(只读)
| 命令 | 用途 |
|---|---|
mail message | 获取单封邮件(含 HTML 或纯文本 body) |
mail messages | 批量获取多封邮件 |
mail thread | 获取邮件线程(对话) |
mail triage | 列出/过滤邮件(folder/label/query/unread-only) |
mail signature | 列出/查看邮箱签名(--mailbox 定位邮箱,旧名 --from 仍兼容;--detail <签名ID> 取单个详情;-o json 返回完整 {signatures, usages};支持 --dry-run) |
# 查未读收件箱
feishu-cli mail triage --folder INBOX --unread-only --page-size 20
# 列出可用文件夹和标签
feishu-cli mail triage --list-folders
feishu-cli mail triage --list-labels
# 搜索邮件
feishu-cli mail triage --query "周会"
# 获取单封
feishu-cli mail message --message-id msg_xxx
feishu-cli mail message --message-id msg_xxx --format plain_text_full
# 批量获取
feishu-cli mail messages --message-ids m1,m2,m3
# 获取线程
feishu-cli mail thread --thread-id thread_xxx
# 列出邮箱签名(默认 mailbox=me)
feishu-cli mail signature
feishu-cli mail signature --mailbox me -o json # JSON 输出含完整 {signatures, usages}
# 查看单个签名详情(从列表里筛出该 ID 的渲染详情)
feishu-cli mail signature --detail 7012345678901234567写入类命令
| 命令 | 用途 |
|---|---|
mail send | 发送邮件(默认草稿,加 --confirm-send 立即发送) |
mail draft-create | 创建草稿(不发送) |
mail draft-edit | 编辑已有草稿(全量覆盖) |
mail reply | 回复邮件(自动 Re: 前缀 + 引用块 + In-Reply-To) |
mail reply-all | 全部回复(包含原邮件 To 和 CC 的所有人,自动排除自己) |
mail forward | 转发邮件(自动 Fwd: 前缀 + 原文;正文 text-only) |
# 发邮件(默认保存为草稿,安全兜底)
feishu-cli mail send --to user@example.com --subject "测试" --body "hi"
# 直接发送
feishu-cli mail send --to user@example.com --subject "测试" --body "hi" --confirm-send
# 多人、抄送、HTML
feishu-cli mail send --to user1@example.com,user2@example.com --cc user3@example.com \
--subject "会议纪要" --body "<h2>议程</h2><p>1. ...</p>" --html --confirm-send
# 创建草稿
feishu-cli mail draft-create --to user@example.com --subject "草稿" --body "初稿"
# 编辑草稿
feishu-cli mail draft-edit --draft-id xxx --to user@example.com --subject "修订" --body "新内容"
# 回复
feishu-cli mail reply --message-id msg_xxx --body "收到,周三开会"
feishu-cli mail reply --message-id msg_xxx --body "同意" --confirm-send
# 全部回复
feishu-cli mail reply-all --message-id msg_xxx --body "+1"
# 转发
feishu-cli mail forward --message-id msg_xxx --to new@example.com --body "请关注此邮件"典型工作流
处理未读邮件
# 1. 查未读
feishu-cli mail triage --folder INBOX --unread-only -o json > unread.json
# 2. 逐封处理(拿 message_id → 看内容 → 回复)
feishu-cli mail message --message-id <id> -o json
feishu-cli mail reply --message-id <id> --body "已阅" --confirm-send发送 HTML 邮件
feishu-cli mail send \
--to team@example.com \
--subject "周报" \
--body "$(cat weekly-report.html)" \
--html \
--confirm-send草稿审阅工作流
# 1. 创建草稿
DRAFT_ID=$(feishu-cli mail draft-create --to user@example.com --subject "合同" --body "初稿" -o json | jq -r .draft_id)
# 2. 审阅后修改
feishu-cli mail draft-edit --draft-id $DRAFT_ID --to user@example.com --subject "合同 v2" --body "修订后内容"
# 3. 通过 mail send 重建为真发送(draft-edit 只更新不发送)
# 或在飞书 Web 上手动发送权限要求
所有 mail 命令均必须使用 User Access Token(先 feishu-cli auth login)。下表覆盖全部 mail 子命令:
| 命令 | 必需 scope |
|---|---|
mail triage | mail:user_mailbox:readonly、mail:user_mailbox.message:readonly、mail:user_mailbox.message.body:read、mail:user_mailbox.message.address:read、mail:user_mailbox.message.subject:read |
mail message / mail messages / mail thread | 同上只读集 |
mail signature | mail:user_mailbox:readonly(签名只需这一个,无需 message.* 系列) |
mail send | 上述只读权限 + mail:user_mailbox.message:send、mail:user_mailbox.message:modify(草稿创建走 :modify,--confirm-send 触发 :send);--inline-images-auto-scan 额外需要 drive:drive、drive:file:upload 和 auth:user.id:read(用于获取上传 parent_node 所需的 open_id) |
mail draft-create / mail draft-edit | 上述只读权限 + mail:user_mailbox.message:modify(仅写草稿,不发送,不需 :send) |
mail reply / mail reply-all / mail forward | 上述只读权限 + mail:user_mailbox.message:send、mail:user_mailbox.message:modify(先建草稿后发送,与 mail send --confirm-send 同) |
mail template create | mail:user_mailbox:readonly + mail:user_mailbox.message:modify |
mail template list | mail:user_mailbox:readonly |
推荐预检:
```bash
# 仅签名(只需一个 scope,不要过度申请 message.* 系列)
feishu-cli auth check --scope "mail:user_mailbox:readonly"
# 消息只读类(message / messages / thread / triage)
feishu-cli auth check --scope "mail:user_mailbox:readonly mail:user_mailbox.message:readonly mail:user_mailbox.message.body:read mail:user_mailbox.message.address:read mail:user_mailbox.message.subject:read"
# 写类(含 send / reply / forward / 草稿)
feishu-cli auth check --scope "mail:user_mailbox:readonly mail:user_mailbox.message:modify mail:user_mailbox.message:send"
```
注意事项
- 默认草稿:
mail send默认只保存草稿(安全兜底)。必须显式加--confirm-send才会真正发送邮件。 - HTML 自动检测:
send / draft-create / draft-edit / reply / reply-all如果--body含以下任一标签会自动按 HTML 发送:<html>/<body>/<div>/<p>/<br>/<b>/<i>/<a/<table>/<h1>/<h2>/<h3>。可用--plain-text或--html强制指定。forward当前没有--html/--plain-text参数。 - 引用块:
reply/reply-all会自动把原邮件 body 作为>引用块附加到回复正文后。 - 发件人识别:不传
--from时,从 mailbox profile(GET /profile)自动读取primary_email_address和name。 - EML 格式:所有发送命令底层都构造 RFC 5322 格式 EML,经过 base64 URL-safe 编码后提交给
/draftsAPI。 - Mailbox 定位:
--mailbox默认me(当前登录用户),也可以传具体邮箱地址(前提是当前 Token 有权限)。 - subject 去重:
reply自动避免Re: Re:重复;forward自动避免Fwd: Fwd:重复。 - In-Reply-To / References:
reply/reply-all自动从原邮件的smtp_message_id/references继承,确保邮件客户端正确展示对话线程。 - 普通附件暂不支持:首期 EML builder 仍不处理普通附件;CID 内联图片已由
mail send --inline-images-auto-scan支持,仅在 HTML body 下生效。 - 批量 messages 上限:取决于飞书 API 端;本命令不做数量校验,但通常建议 ≤50 条。
高级能力(v1.23+ mail-advanced)
CID 内联图片自动扫描
mail send --inline-images-auto-scan 自动扫描 HTML body 中 <img src="本地路径"> → 上传 drive (parent_type=email) → 重写为 cid:xxx → multipart/related 拼装。
- 路径安全:拒
..路径遍历;限 cwd / home 子树内 - 多媒体合规:RFC 2046 multipart/related CRLF 严格(每 part body 末尾
\r\n+ 边界前\r\n隔离) - 跳过已有 scheme:
cid:/http(s):/data:///cdn等不重复上传 - 仅 HTML body 生效;纯文本下静默跳过
- 需要
auth login缓存里有当前用户open_id(drive upload 的parent_node必填)
# 自动扫描内嵌图,HTML body 中 <img src="./figs/chart.png"> 会被改写为 cid:xxx
feishu-cli mail send --to user@example.com --subject "周报" \
--body "$(cat report.html)" --html --inline-images-auto-scan --confirm-send邮件模板 create/list(MVP)
# 创建模板(body 直接传字符串;读文件请用 shell 展开)
feishu-cli mail template create --name "周报模板" \
--subject "本周进度" --body "$(cat template.html)"
# 列出全部模板(接口不分页,一次性返回 id+name)
feishu-cli mail template list
feishu-cli mail template list -o json模板接口使用邮箱读写相关 User Token 权限。建议先预检:
feishu-cli auth check --scope "mail:user_mailbox:readonly mail:user_mailbox.message:modify"未做(暂未 MVP)
receipt send/decline / watch (WebSocket) / share-to-chat / template update / template delete
v1 PR quality-pass 加固
- SMTP header injection 防御:
--from/--from-name/--subject/--in-reply-to/--references以及 to/cc/bcc/inline 图片 filename/cid 不能含 CR/LF,命中即 cli 层 reject 不发送 - 内嵌图片:
--inline-images-auto-scan用filepath.EvalSymlinks解软链 + Lstat + 10MB size cap;非常规文件(设备 / FIFO / socket)和 > 10MB 直接 reject - `mail send` 没有 `--template-id` flag:
mail template create输出的 template_id 仅用于查询/管理,飞书 API 暂未提供 send 时直接引用模板的能力(v1 PR 修正了 mail template create help 的误导)
Related skills
How it compares
Choose feishu-cli-mail over generic SMTP scripts when workplace mail must run through authenticated Feishu/Lark APIs and CLI workflows.
FAQ
What authentication does feishu-cli-mail require?
feishu-cli-mail requires a User Access Token from feishu-cli auth login before any mail subcommand runs. The skill documents that all mail operations depend on that authenticated CLI session.
Does feishu-cli-mail support HTML email bodies?
feishu-cli-mail supports plain text or HTML bodies for send, draft-create, draft-edit, reply, and reply-all using --html flags. Forward currently accepts plain text bodies only in the documented first-release limits.