飞书邮箱(Mail)操作。查看邮件、发送邮件、回复、转发、管理草稿、批量获取、线程、过滤。 当用户请求"发邮件"、"看邮件"、"查邮件"、"回复邮件"、"转发邮件"、"邮件草稿"、"收件箱"、 "feishu mail"、"lark mail"、"未读邮件"时使用。 所有命令需要 User Access Token(先 feishu-cli auth login)。 首期限制:发送/回复/转发仅支持纯文本或 HTML body,暂不支持附件和 CID 内联图片。
查看、发送、回复、转发邮件,管理草稿,过滤收件箱。
首期限制:
send / draft-create / draft-edit / reply / reply-all / forward仅支持纯文本/HTML body,暂不支持附件和 CID 内联图片。
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) |
# 查未读收件箱
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
| 命令 | 用途 |
|---|---|
mail send | 发送邮件(默认草稿,加 --confirm-send 立即发送) |
mail draft-create | 创建草稿(不发送) |
mail draft-edit | 编辑已有草稿(全量覆盖) |
mail reply | 回复邮件(自动 Re: 前缀 + 引用块 + In-Reply-To) |
mail reply-all | 全部回复(包含原邮件 To 和 CC 的所有人,自动排除自己) |
mail forward | 转发邮件(自动 Fwd: 前缀 + 原文) |
# 发邮件(默认保存为草稿,安全兜底)
feishu-cli mail send --to [email protected] --subject "测试" --body "hi"
# 直接发送
feishu-cli mail send --to [email protected] --subject "测试" --body "hi" --confirm-send
# 多人、抄送、HTML
feishu-cli mail send --to [email protected],[email protected] --cc [email protected] \
--subject "会议纪要" --body "<h2>议程</h2><p>1. ...</p>" --html --confirm-send
# 创建草稿
feishu-cli mail draft-create --to [email protected] --subject "草稿" --body "初稿"
# 编辑草稿
feishu-cli mail draft-edit --draft-id xxx --to [email protected] --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 [email protected] --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
feishu-cli mail send \
--to [email protected] \
--subject "周报" \
--body "$(cat weekly-report.html)" \
--html \
--confirm-send
# 1. 创建草稿
DRAFT_ID=$(feishu-cli mail draft-create --to [email protected] --subject "合同" --body "初稿" -o json | jq -r .draft_id)
# 2. 审阅后修改
feishu-cli mail draft-edit --draft-id $DRAFT_ID --to [email protected] --subject "合同 v2" --body "修订后内容"
# 3. 通过 mail send 重建为真发送(draft-edit 只更新不发送)
# 或在飞书 Web 上手动发送
| 命令 | 必需 scope |
|---|---|
mail message/messages/thread/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 send/draft-create/draft-edit/reply/reply-all/forward | 上述只读权限 + mail:user_mailbox.message:send、mail:user_mailbox.message:modify |
mail send 默认只保存草稿(安全兜底)。必须显式加 --confirm-send 才会真正发送邮件。--body 含以下任一标签自动按 HTML 发送:<html> / <body> / <div> / <p> / <br> / <b> / <i> / <a / <table> / <h1> / <h2> / <h3>。可用 --plain-text 或 --html 强制指定。reply/reply-all 会自动把原邮件 body 作为 > 引用块附加到回复正文后。--from 时,从 mailbox profile(GET /profile)自动读取 primary_email_address 和 name。/drafts API。--mailbox 默认 me(当前登录用户),也可以传具体邮箱地址(前提是当前 Token 有权限)。reply 自动避免 Re: Re: 重复;forward 自动避免 Fwd: Fwd: 重复。reply/reply-all 自动从原邮件的 smtp_message_id / references 继承,确保邮件客户端正确展示对话线程。