dingtalk-mail
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese钉钉邮箱 Skill
DingTalk Email Skill
前置条件 — 执行操作前必读
Prerequisites — Read before performing any operation
**CRITICAL — 执行任何操作前,MUST 先用 Read 工具完整读取dws。**该轻量文件包含全局执行契约、安全底线及 shared references 的按需加载导航;不要预加载其全部 references。dingtalk-shared
<!-- VISIBLE_SHORTCUTS_START -->命令参考:mail.md。复杂搜索、附件、批量处理、草稿等多步邮件场景参考:09-mail.md。
CRITICAL — Before executing anyoperation, you MUST first use the Read tool to fully readdws. This lightweight file contains the global execution contract, security baseline, and on-demand loading navigation for shared references; do not pre-load all its references.dingtalk-shared
<!-- VISIBLE_SHORTCUTS_START -->Command reference: mail.md. For multi-step email scenarios such as complex search, attachments, batch processing, drafts, see: 09-mail.md.
Shortcuts(无专用脚本/recipe 时优先)
Shortcuts (preferred when no dedicated script/recipe exists)
以下 shortcut 同时进入公开 catalog 与 Runtime Schema。按本 skill/recipe 路由,命中时 Shortcut 优先于原子命令。参数只查 ;仅需且已发布 时查 ,字段级再查 ;缺失不以 Help/样例推断。Schema 不可用才读一次已知 leaf Help; 用同 leaf Help 修正一次。 禁 Help:错误 suggestion → 已加载 Skill/reference 明确入口;均无则报漂移。禁全 Catalog/root/parent/product Help;仅映射、接口或 provenance 审计省略 。现有路由和 reference 均无法定位低频能力时,才用 发现。
dws schema --cli-path "mail +<shortcut>" --compact --jq '{cli_path,parameters,constraints,confirmation}' -f jsonresult--jq '{cli_path,outcomes:.result.outcomes,pagination}'data_schemaunknown flagunknown command--compactdws shortcut list --service mail --format json| Shortcut | 风险 | 适用场景 |
|---|---|---|
| read | 按关键词搜索邮箱联系人并投影列表(姓名/昵称/邮箱/工号等) |
| read | 列出顶层文件夹或指定父文件夹下的子文件夹 |
| read | 读取一封邮件的完整正文与附件元数据 |
| read | 按请求顺序读取多封邮件并逐封验证身份 |
| read | 按 KQL 关键词搜索邮件并投影列表(主题/发件人/时间/messageId) |
| read | 读取完整邮件会话并精确验证 conversationId |
| read | 列出或筛选邮件摘要,自动解析邮箱与收件箱 |
| read | 按关键词或工号搜索邮箱用户(仅企业邮箱) |
The following shortcuts enter both the public catalog and Runtime Schema. Route according to this skill/recipe; when matched, Shortcuts take precedence over atomic commands. For parameters, only query ; when only the published is needed, query , and for field-level details query ; do not infer missing parts from Help or examples. Only read a known leaf Help once when the Schema is unavailable; fix an once with the same leaf Help. forbids Help: wrong suggestion → use the explicit entry in the loaded Skill/reference; if neither exists, report drift. Forbid full Catalog/root/parent/product Help; omit only for mapping, interface, or provenance audits. When existing routes and references cannot locate a low-frequency capability, use to discover.
dws schema --cli-path "mail +<shortcut>" --compact --jq '{cli_path,parameters,constraints,confirmation}' -f jsonresult--jq '{cli_path,outcomes:.result.outcomes,pagination}'data_schemaunknown flagunknown command--compactdws shortcut list --service mail --format json| Shortcut | Risk | Use case |
|---|---|---|
| read | Search email contacts by keyword and project a list (name/nickname/email/employee ID, etc.) |
| read | List top-level folders or subfolders under a specified parent folder |
| read | Read the full body and attachment metadata of one email |
| read | Read multiple emails in the requested order and verify identity one by one |
| read | Search emails by KQL keywords and project a list (subject/sender/time/messageId) |
| read | Read the full email conversation and precisely verify conversationId |
| read | List or filter email summaries, automatically resolve mailbox and inbox |
| read | Search mailbox users by keyword or employee ID (enterprise mailbox only) |
意图表
Intent Table
| 用户说 | 命令 |
|---|---|
| "发邮件给 a@b.com" | |
| "回复 / 全部回复 / 转发" | |
| "今天未读邮件" | |
| "带抄送发送" | |
| User says | Command |
|---|---|
| "Send email to a@b.com" | |
| "Reply / Reply all / Forward" | |
| "Today's unread emails" | |
| "Send with CC" | |
标准 SOP(必遵流程)
Standard SOP (Mandatory Process)
命中以下意图必须按对应 SOP 顺序执行;禁止跳步、替换命令、编造 email/messageId。每条命令必须带。收件邮箱必须真实解析,禁止猜测。--format json
When the following intents are matched, you must execute them in the corresponding SOP order; do not skip steps, replace commands, or fabricate email/messageId. Every command must include. The recipient mailbox must be actually resolved; do not guess.--format json
SOP-1 拿邮箱(get-mailbox)
SOP-1 Get Mailbox (get-mailbox)
触发:我的邮箱/发件需要邮箱/查邮件需要邮箱。
- 执行(必须):,取自己的
dws mail mailbox list --format json(默认选企业邮箱email);查他人邮箱用type:ORG,禁止用dws mail user search --keyword "<姓名>" --format json查他人。mailbox list
禁止:把 当作他人邮箱查询、猜测邮箱地址。
mailbox listTrigger: my mailbox / sending needs a mailbox / checking email needs a mailbox.
- Execute (required): , get your own
dws mail mailbox list --format json(default to enterprise mailboxemail); usetype:ORGto look up other users' mailboxes; do not usedws mail user search --keyword "<name>" --format jsonto look up others.mailbox list
Forbidden: use as a query for others' mailboxes, or guess email addresses.
mailbox listSOP-2 查 / 搜邮件(search-mail)
SOP-2 View / Search Email (search-mail)
触发:查邮件/搜邮件/某主题邮件/某人发的邮件。
- 拿邮箱(必须):先按 SOP-1 取 ;用户已明确提供可跳过。
email - 执行(必须):浏览文件夹 ;KQL 搜索
dws mail message list --email <邮箱> --limit <n> --format json(KQL 如dws mail message search --email <邮箱> --query "<KQL>" --limit 20 --format json、subject:周报、from:alice@x.com、folderId:2,只通过hasAttachments:true传)。--query - 取正文(必须):;
dws mail message get --email <邮箱> --id <messageId> --format json从列表/搜索结果取,禁止编造。messageId
禁止:把 KQL 拆成多个 flag、跳过 直接猜 messageId。
message list/searchTrigger: view emails / search emails / emails on a topic / emails from someone.
-
Get mailbox (required): first obtainper SOP-1; may skip if the user explicitly provided it.
email -
Execute (required): browse folders; KQL search
dws mail message list --email <mailbox> --limit <n> --format json(KQL examples:dws mail message search --email <mailbox> --query "<KQL>" --limit 20 --format json,subject:weekly report,from:alice@x.com,folderId:2; only pass viahasAttachments:true).--query -
Get body (required):; take
dws mail message get --email <mailbox> --id <messageId> --format jsonfrom the list/search results, do not fabricate.messageId
Forbidden: split KQL into multiple flags, skip and guess messageId directly.
message list/searchSOP-3 发邮件(send-mail)
SOP-3 Send Email (send-mail)
触发:发邮件/写邮件/群发。
- 发件邮箱(必须):取自己邮箱。
dws mail mailbox list - 收件邮箱(必须):地址直接用;姓名按 mail.md "查找他人邮箱地址"流程(等)获取,禁止猜测。
mail user search - 执行(必须):;按需
dws mail message send --from <发件邮箱> --to <收件邮箱> --subject "<主题>" --content "<正文>" --format json/--cc/--attachment。--inline-attachment - 验证(必须):从发送返回取真实 ,执行
internetMessageId查发送状态;不要把普通dws mail message verify --email <发件邮箱> --internet-message-id <internetMessageId> --format json传给 verify。messageId
禁止:猜测收件邮箱、发送后不确认状态就答复"已发送"。
Trigger: send email / write email / mass send.
-
Sender mailbox (required): get your own mailbox via.
dws mail mailbox list -
Recipient mailbox (required): use the address directly; for names, obtain the address per the "find other's email address" flow in mail.md (viaetc.); do not guess.
mail user search -
Execute (required):; add
dws mail message send --from <sender mailbox> --to <recipient mailbox> --subject "<subject>" --content "<body>" --format json/--cc/--attachmentas needed.--inline-attachment -
Verify (required): get the realfrom the send response, run
internetMessageIdto check the sending status; do not pass a normaldws mail message verify --email <sender mailbox> --internet-message-id <internetMessageId> --format jsonto verify.messageId
Forbidden: guess the recipient mailbox, or reply "sent" without confirming the status after sending.
SOP-4 回复 / 转发(reply-forward)
SOP-4 Reply / Forward (reply-forward)
触发:回复邮件/回复全部/转发。
- 拿邮箱 + 原邮件(必须):SOP-1 取邮箱;用户未给 时必须先走 SOP-2 定位原邮件
messageId。messageId - 执行(必须):回复 ;回复全部用
dws mail message reply --from <邮箱> --id <messageId> --content "<正文>" --format json;转发reply-all。dws mail message forward --from <邮箱> --to <收件邮箱> --id <messageId> --content "<附言>" --format json
禁止:未定位原邮件就回复/转发、编造 messageId。
Trigger: reply to email / reply all / forward.
-
Get mailbox + original email (required): get mailbox via SOP-1; if the user did not provide a, you must first locate the original email's
messageIdvia SOP-2.messageId -
Execute (required): reply; use
dws mail message reply --from <mailbox> --id <messageId> --content "<body>" --format jsonfor reply all; forwardreply-all.dws mail message forward --from <mailbox> --to <recipient mailbox> --id <messageId> --content "<note>" --format json
Forbidden: reply/forward without locating the original email, or fabricate messageId.
高频硬约束
High-Frequency Hard Constraints
- 用户要"完整内容/看看这封邮件/正文"时,命中后必须继续调用
message search;不要只列候选后停下。dws mail message get --email <邮箱> --id <messageId> --format json - 搜到多封邮件时,若用户给了明确主题、附件名、发件人或时间线索,先选最匹配的一封执行 ;只有同等候选无法判断时才询问用户。
message get - 附件链路固定三步:→
message search→attachment list --email <邮箱> --id <messageId>;不存在批量下载命令。attachment download --email <邮箱> --message-id <messageId> --attachment-id <attachmentId> --name <文件名> - 写入类操作(发送、回复、转发、删除、批量移动)按安全策略确认;只读查看、搜索、附件列表、下载不需要确认。
- 所有 命令加
dws mail,并复用同一封邮件的--format json,不要重新搜索导致目标漂移。messageId
-
When the user asks for "full content / view this email / body", after ahit you must continue to call
message search; do not stop after listing candidates.dws mail message get --email <mailbox> --id <messageId> --format json -
When multiple emails are found, if the user gave a clear subject, attachment name, sender, or time clue, first select the best match and run; only ask the user when equally matching candidates cannot be distinguished.
message get -
The attachment chain is fixed in three steps:→
message search→attachment list --email <mailbox> --id <messageId>; there is no batch download command.attachment download --email <mailbox> --message-id <messageId> --attachment-id <attachmentId> --name <filename> -
Write operations (send, reply, forward, delete, batch move) require confirmation per security policy; read-only views, searches, attachment listings, and downloads do not require confirmation.
-
Addto all
--format jsoncommands, and reuse the same email'sdws mail; do not re-search causing target drift.messageId
轨迹高频直达规则
High-Frequency Direct Access Rules
- 已被本页或 精确覆盖的命令,直接执行;不要先探测
09-mail.md、contact、api、auth、Help 或 Schema。仅在命令真实报参数错误后,读取该命令的 leaf Help 一次。profile - 多条件 KQL 必须用显式 ,例如收件箱附件邮件:
AND;不要把相邻条件当作隐式 AND。hasAttachments:true AND folderId:2 - 用户只要首个或任一单附件时,初始搜索后按相关性最多检查 3 个候选的 ,下载命中附件并做一次本地存在性/大小检查后停止;若均未命中,只能说明已检查范围并询问是否继续翻页,不能断言不存在。用户要求全部/批量附件时,遍历全部匹配页和邮件,再逐个下载每个附件。
attachment list - “创建邮箱联系人”属于邮箱个人通讯录,固定走 ,不要切到
dws mail contact create/list。只有“按人名解析邮件收件地址”才走下方跨产品协作。dingtalk-contact - 用户要求用当前时间生成唯一标题且未指定显示格式时,使用紧凑格式 ;只有用户明确要求
date +%H%M%S等格式时才原样保留。HH:mm:ss - 批量删除邮件或将整会话移入已删除前,先展示精确目标和不含确认参数的命令预览并停止;用户明确确认后,执行流程仅对同一组参数追加 。操作成功后只做一次针对原 ID 或唯一主题的回读,结果符合预期即停止。
--yes - 创建类返回了 、
messageId或contactId时,后续直接复用返回 ID;不要为了重新定位目标而做宽泛 list/search。internetMessageId - 一次精确回读已经证明目标状态后结束任务;若回读冲突,报告冲突和已执行命令,不扩大到低层 API 或其他产品继续试探。
-
For commands precisely covered by this page or, execute directly; do not first probe
09-mail.md,contact,api,auth, Help, or Schema. Only after the command actually reports a parameter error, read that command's leaf Help once.profile -
Multi-condition KQL must use explicit, e.g., inbox emails with attachments:
AND; do not treat adjacent conditions as implicit AND.hasAttachments:true AND folderId:2 -
When the user only wants the first or any single attachment, after the initial search check at most 3 candidates'by relevance, download the hit attachment, do a local existence/size check, then stop; if none hit, only state the checked scope and ask whether to continue paging; do not assert it does not exist. When the user asks for all/batch attachments, traverse all matching pages and emails, then download each attachment one by one.
attachment list -
"Create mailbox contact" belongs to the mailbox personal address book; always use, do not switch to
dws mail contact create/list. Only "resolve email recipient address by person name" uses the cross-product collaboration below.dingtalk-contact -
When the user requires generating a unique title with the current time and no display format is specified, use the compact format; only preserve formats like
date +%H%M%Swhen the user explicitly requests them.HH:mm:ss -
Before batch-deleting emails or moving an entire conversation to deleted, first show the precise targets and a command preview without the confirmation parameter, then stop; after the user explicitly confirms, the execution flow appendsto the same set of parameters only. After the operation succeeds, do a single readback targeting the original ID or unique subject; stop when the result matches expectations.
--yes -
When a create-type operation returns,
messageId, orcontactId, subsequently reuse the returned ID directly; do not do broad list/search to re-locate the target.internetMessageId -
End the task after one precise readback has proven the target state; if the readback conflicts, report the conflict and executed commands; do not expand to lower-level APIs or other products to continue probing.
跨产品协作
Cross-Product Collaboration
- 收件人是人名 → 先用 取
dingtalk-contactorgAuthEmail - 钉钉内消息 → 切到
dingtalk-chat
-
Recipient is a person name → first useto get
dingtalk-contactorgAuthEmail -
DingTalk internal messages → switch to
dingtalk-chat
局部意图与短流程
Local Intents and Mini-Flows
- 局部意图消歧;短流程。
- Local intent disambiguation; mini-flows.