首页
看点啥
插画图片
首页 科技看点 AgentMail:专为 AI 代理设计的 API 优先邮件平台 - Openclaw Skills

AgentMail:专为 AI 代理设计的 API 优先邮件平台 - Openclaw Skills

2026-08-17 0

什么是 AgentMail?

AgentMail 是专为 AI 代理从零设计的专业邮件基础设施。与 Gmail 或 Outlook 等消费级邮件服务不同,AgentMail 专注于程序化访问,为 Openclaw Skills 提供创建、管理和扩展基于邮件身份的能力。它为需要将邮件功能集成到代理工作流中的开发人员提供了无缝体验,无需处理复杂的 OAuth 流程或严格的速率限制。

通过使用 AgentMail,您的代理将获得一个能够处理富文本、HTML 内容和文件附件的专业通信渠道。该平台是需要可靠入站和出站通信的 Openclaw Skills 的核心组件,使代理能够在维护开发人员优先的基础设施方法的同时,作为全球邮件生态系统中的一等公民发挥作用。

下载入口:https://github.com/openclaw/skills/tree/main/skills/adboio/agentmail

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install agentmail

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 agentmail。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

AgentMail 应用场景

AgentMail 工作原理
  1. 通过 AgentMail 仪表板创建账户并生成安全的 API 密钥。
  2. 使用 Python SDK 以编程方式生成具有自定义用户名的收件箱。
  3. 直接从您的代理代码中发送带有附件和富 HTML 格式的消息。
  4. 配置实时 Webhook,将传入的邮件推送到后端进行即时处理。
  5. 通过 Clawdbot 应用安全转换,以允许受信任的发送者并防止提示注入。

AgentMail 配置指南

要将 AgentMail 集成到您的 Openclaw Skills 中,请执行以下安装步骤:

  1. 在 console.agentmail.to 注册并获取您的 API 密钥。
  2. 安装所需的依赖项:
pip install agentmail python-dotenv
  1. 在项目配置中设置环境变量:
export AGENTMAIL_API_KEY='your_api_key_here'
  1. 在脚本中初始化客户端,开始管理收件箱和发送邮件。

AgentMail 数据架构与分类体系

AgentMail 组织其数据以使其易于被 Openclaw Skills 访问,重点关注程序化实体:

组件 功能 属性
收件箱 (Inbox) 代表代理的邮件账户。 inbox_id, username, client_id
消息 (Message) 邮件传输的有效载荷。 to, subject, text, html, attachments
Webhook 实时事件的配置。 url, client_id
附件 (Attachment) 与消息关联的文件。 filename, content (base64)

所有数据都通过 API 优先的方法处理,确保邮件可以轻松解析为结构化格式供 LLM 使用。

name: agentmail
description: API-first email platform designed for AI agents. Create and manage dedicated email inboxes, send and receive emails programmatically, and handle email-based workflows with webhooks and real-time events. Use when you need to set up agent email identity, send emails from agents, handle incoming email workflows, or replace traditional email providers like Gmail with agent-friendly infrastructure.

AgentMail

AgentMail is an API-first email platform designed specifically for AI agents. Unlike traditional email providers (Gmail, Outlook), AgentMail provides programmatic inboxes, usage-based pricing, high-volume sending, and real-time webhooks.

Core Capabilities

Quick Start

  1. Create an account at console.agentmail.to
  2. Generate API key in the console dashboard
  3. Install Python SDK: pip install agentmail python-dotenv
  4. Set environment variable: AGENTMAIL_API_KEY=your_key_here

Basic Operations

Create an Inbox

from agentmail import AgentMail

client = AgentMail(api_key=os.getenv("AGENTMAIL_API_KEY"))

# Create inbox with custom username
inbox = client.inboxes.create(
    username="spike-assistant",  # Creates [email protected]
    client_id="unique-identifier"  # Ensures idempotency
)
print(f"Created: {inbox.inbox_id}")

Send Email

client.inboxes.messages.send(
    inbox_id="[email protected]",
    to="[email protected]",
    subject="Task completed",
    text="The PDF rotation is finished. See attachment.",
    html="

The PDF rotation is finished. See attachment.

", attachments=[{ "filename": "rotated.pdf", "content": base64.b64encode(file_data).decode() }] )

List Inboxes

inboxes = client.inboxes.list(limit=10)
for inbox in inboxes.inboxes:
    print(f"{inbox.inbox_id} - {inbox.display_name}")

Advanced Features

Webhooks for Real-Time Processing

Set up webhooks to respond to incoming emails immediately:

# Register webhook endpoint
webhook = client.webhooks.create(
    url="https://your-domain.com/webhook",
    client_id="email-processor"
)

See WEBHOOKS.md for complete webhook setup guide including ngrok for local development.

Custom Domains

For branded email addresses (e.g., [email protected]), upgrade to a paid plan and configure custom domains in the console.

Security: Webhook Allowlist (CRITICAL)

?? Risk: Incoming email webhooks expose a prompt injection vector. Anyone can email your agent inbox with instructions like:

Solution: Use a Clawdbot webhook transform to allowlist trusted senders.

Implementation

  1. Create allowlist filter at ~/.clawdbot/hooks/email-allowlist.ts:
const ALLOWLIST = [
  '[email protected]',           // Your personal email
  '[email protected]', // Any trusted services
];

export default function(payload: any) {
  const from = payload.message?.from?.[0]?.email;
  
  // Block if no sender or not in allowlist
  if (!from || !ALLOWLIST.includes(from.toLowerCase())) {
    console.log(`[email-filter] ? Blocked email from: ${from || 'unknown'}`);
    return null; // Drop the webhook
  }
  
  console.log(`[email-filter] ? Allowed email from: ${from}`);
  
  // Pass through to configured action
  return {
    action: 'wake',
    text: `?? Email from ${from}:

${payload.message.subject}

${payload.message.text}`,
    deliver: true,
    channel: 'slack',  // or 'telegram', 'discord', etc.
    to: 'channel:YOUR_CHANNEL_ID'
  };
}
  1. Update Clawdbot config (~/.clawdbot/clawdbot.json):
{
  "hooks": {
    "transformsDir": "~/.clawdbot/hooks",
    "mappings": [
      {
        "id": "agentmail",
        "match": { "path": "/agentmail" },
        "transform": { "module": "email-allowlist.ts" }
      }
    ]
  }
}
  1. Restart gateway: clawdbot gateway restart

Alternative: Separate Session

If you want to review untrusted emails before acting:

{
  "hooks": {
    "mappings": [{
      "id": "agentmail",
      "sessionKey": "hook:email-review",
      "deliver": false  // Don't auto-deliver to main ch@t
    }]
  }
}

Then manually review via /sessions or a dedicated command.

Defense Layers

  1. Allowlist (recommended): Only process known senders
  2. Isolated session: Review before acting
  3. Untrusted markers: Flag email content as untrusted input in prompts
  4. Agent training: System prompts that treat email requests as suggestions, not commands

Scripts Available

References

When to Use AgentMail

喜欢(0)

上一篇

《漫威蜘蛛侠2》电影联动服装遭批评 赶工敷衍毫无诚意

《漫威蜘蛛侠2》电影联动服装遭批评 赶工敷衍毫无诚意

下一篇

蚂蚁新村今日2月23日答案更新

蚂蚁新村今日2月23日答案更新
猜你喜欢