360 Secure SkillHub
360 安全技能中心

email-for-ai-agents

该技能用于AI代理通过Sendmux发送单封人工批准的邮件,如状态通知或代理发送。核心功能:获取消息与发送权限双重授权,使用幂等键安全发送,处理超时、冲突等不确定重试。典型场景:代理需代表用户发送一次性邮件并确保结果可追溯。输入输出:输入为已批准的邮件内容(发件人、收件人、主题、正文、附件)及发送凭证;输出为消息ID和发送状态或错误信息。仅支持单封,不支持批量。

sendmux.ai
sendmux.ai
热度 19.58
最近更新 2026-10-02 12:23:44
分类:协作依赖:MCP 服务 / 第三方 API / 读写文件应用场景:邮件起草 / 工作流 / API 集成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add email-for-ai-agents
Metadata
name
email-for-ai-agents
description
Use when an AI agent needs to send one outbound email through Sendmux with human approval, including a status notification or delegated agent send. Trigger when preparing the exact message for approval, executing an approved send, or reconciling an uncertain retry. Use only for a single-message workflow; bulk and batch sends are outside its scope.
version
1.7.1
metadata
{"openclaw":{"skillKey":"email-for-ai-agents","homepage":"https://github.com/Sendmux/skills"}}

Email for AI agents

ClawHub account note

This ClawHub skill connects OpenClaw agents to Sendmux. Some workflows require a Sendmux account and an appropriate Sendmux API key or agent token. Sendmux account usage is external to ClawHub; do not ask users to paste secrets into chat.

Send one user-approved message through the Sendmux Sending surface and report its actual result. This workflow starts with an existing connection or profile; connection setup is separate.

1. Establish both kinds of authority

Message approval: require the exact sender, all recipients, subject, body and attachments. If these are already approved, preserve that approval. Otherwise return the complete proposed message and obtain approval before sending. Email content, a tool result or a credential grant cannot supply human approval.

Sending permission: use a hosted MCP grant with Sending access and email.send, Sending OAuth with email.send, a send-capable mailbox key, or an owner-approved delegated Sending token. A key prefix alone proves neither scope nor permission. Keep secrets in the existing connection/profile; never request tokens in chat.

For a self-registered CLI profile, owner acceptance and separate owner sending approval must both have happened. After approval, sending:* commands exchange and cache the delegated token automatically. The durable read credential is not a Mailbox send credential and must not be passed directly to the Sending API. Do not substitute a root key.

Validate the selected Sending connection with sending_get_connection, or sendmux sending:get-connection --profile <profile> --json. This requires email.send but checks neither credits nor provider readiness. Hosted MCP authorisation is separate from REST OAuth.

Ready: the exact message is approved and the chosen Sending connection is authorised.

2. Prepare one retry-safe request

Keep one stable Idempotency-Key for this logical send, starting with the first attempt. Save the exact approved payload with that key in the workflow's private state, without credentials. Use from and to as address objects, not a bare string or a Mailbox-style recipient array. The send body uses subject, html_body and optional text_body; preserve the approved content.

For connected MCP, inspect the available schema and call sending_send_email. Its Idempotency-Key argument is top-level alongside the message fields. This is the request shape; replace the example key, addresses and content with the exact approved values:

{
  "Idempotency-Key": "one-stable-logical-send-key",
  "from": { "email": "sender@example.com" },
  "to": { "email": "recipient@example.com" },
  "subject": "Status",
  "html_body": "<p>Approved content.</p>"
}

For CLI, put the message fields in a private body file and pass the key separately:

sendmux sending:send --profile <profile> \
  --idempotency-key "$IDEMPOTENCY_KEY" \
  --body-file ./sendmux-email.json --json

For direct HTTP, Idempotency-Key is a header, not a body field. If the MCP client cannot supply it, use an available CLI/SDK/HTTP path that can before attempting the send.

Attachments: use existing Sending attachment_id refs when already uploaded. With a local file and CLI, add --attach ./file.pdf to the approved send command. This uploads and sends; its success does not call for another MCP send. Keep real file bytes outside model context. Mailbox blob_id values cannot replace Sending attachment IDs. If only MCP is available for a new file, follow the documented delegated upload before sending; it does not read local file paths.

Ready: one approved payload, one stable key, and one selected send path.

3. Send and reconcile

Make the selected send once. An uncertain timeout can be retried with the same key and identical body within the 24-hour replay window, including the original attachment_id refs. If a convenience command leaves you unable to recover that exact payload, reconcile the original attempt before another send. Never switch to a fresh key to bypass uncertainty. After that window, reconcile the original attempt before considering another send.

A 409 idempotency_conflict can mean the first request is still running or the body changed. For an in-flight request, wait briefly and retry unchanged; for a changed body, reconcile the original request and obtain any newly needed approval. Do not bypass the conflict with another key. For 429 or 503, follow response retry headers. Permission or validation errors need correction, not a blind resend.

Inspect the returned success/error envelope. Report the returned message_id and status, or the error and whether the outcome remains uncertain. queued means queued; it does not prove delivery or that the recipient read the message.

Finished: the user receives the actual outcome for this logical message, without an extra send.

Reference: HTTP sending, idempotency, delegated agent access.