mcpField
A
agentmail-cli

agentmail-cli

github.com/agentmail-to生产力251.7k 次安装2 天前更新
代码仓库

关于 agentmail-cli

AgentMail CLI 是用于管理 AgentMail 邮件资源的命令行工具,支持收件箱、邮件、草稿、Pod、Webhook 和域名,并提供多种输出格式及响应转换。

主要功能

  1. 01管理收件箱和邮件
  2. 02列出、读取和发送会话
  3. 03创建并发送草稿
  4. 04通过 Pod 组织收件箱
  5. 05配置 Webhook 和域名
  6. 06选择输出格式并转换响应

适用场景

  1. 01通过命令行管理 Agent 收件箱
  2. 02发送邮件或准备草稿
  3. 03查看邮件和会话
  4. 04管理 Pod、Webhook 和域名

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/agentmail-to/agentmail-skills --skill agentmail-cli

安装后在 Claude Code 中输入/agentmail-cli确认已加载。

详细介绍

AgentMail CLI

安装 CLI,并通过环境变量提供 API 密钥。

npm install -g agentmail-cli
export AGENTMAIL_API_KEY="am_..."

嵌套在另一个资源下的资源属于嵌套子命令,例如 inboxes messages、inboxes threads、pods inboxes、pods threads(CLI 1.x;不接受冒号形式 inboxes:messages)。运行 agentmail <resource> --help 可查看资源支持的操作。

收件箱

agentmail inboxes list
agentmail inboxes get --inbox-id <inbox_id>
agentmail inboxes create --display-name "Support Agent" --username support
agentmail inboxes delete --inbox-id <inbox_id>

运行具有破坏性的删除命令前,请确认收件箱的确切名称。

消息和会话

agentmail inboxes messages list --inbox-id <inbox_id>
agentmail inboxes messages get --inbox-id <inbox_id> --message-id <message_id>

agentmail inboxes messages send --inbox-id <inbox_id> \
  --to "[email protected]" \
  --subject "Hello" \
  --text "Message body"

# HTML body instead of plain text
agentmail inboxes messages send --inbox-id <inbox_id> \
  --to "[email protected]" \
  --subject "Hello" \
  --html "<h1>Hello</h1>"

agentmail inboxes messages reply --inbox-id <inbox_id> \
  --message-id <message_id> \
  --text "Reply body"

agentmail inboxes messages forward --inbox-id <inbox_id> \
  --message-id <message_id> \
  --to "[email protected]"

agentmail inboxes threads list --inbox-id <inbox_id>
agentmail inboxes threads get --inbox-id <inbox_id> --thread-id <thread_id>

回复时请使用消息 ID。依赖消息正文内容前,请先获取完整消息。

草稿

agentmail inboxes drafts create --inbox-id <inbox_id> \
  --to "[email protected]" \
  --subject "Pending approval" \
  --text "Draft body"

agentmail inboxes drafts list --inbox-id <inbox_id>
agentmail inboxes drafts get --inbox-id <inbox_id> --draft-id <draft_id>
agentmail inboxes drafts send --inbox-id <inbox_id> --draft-id <draft_id>

Pod

Pod 将多个收件箱归为一组。

agentmail pods create --name "My Pod"
agentmail pods list

agentmail pods inboxes create --pod-id <pod_id> --display-name "Pod Inbox"
agentmail pods inboxes list --pod-id <pod_id>

agentmail pods threads list --pod-id <pod_id>
agentmail pods threads get --pod-id <pod_id> --thread-id <thread_id>

Webhook

agentmail webhooks create --url "https://example.com/webhook" --event-type message.received
agentmail webhooks list

域名

agentmail domains create --domain example.com

# Optional: route bounce/complaint notifications to your inboxes.
agentmail domains create --domain example.com --feedback-enabled

agentmail domains verify --domain-id <domain_id>
agentmail domains get-zone-file --domain-id <domain_id>

全局标志

标志用途
--api-key为本次调用覆盖 AGENTMAIL_API_KEY
--base-url指向非默认 API 主机
--environment选择一个命名环境
--format输出格式(见下文)
--format-error控制结构化错误输出
--transform对成功响应进行 GJSON 投影
--transform-error对错误响应进行 GJSON 投影
--debug输出详细的请求/响应日志

输出格式

--format 接受:auto(默认)、pretty、json、jsonl、yaml、raw、explore。

使用此处未介绍的管理命令前,请先运行 agentmail --help 和相关资源的 --help。

评论

支持 Markdown