[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-0e692314-fcf5-4383-a2d2-38f2da95f97e":3,"$fGFOzwueTPotv_nd-d7WvgisuOPUqAPxbpMgVLJeAkzI":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"0e692314-fcf5-4383-a2d2-38f2da95f97e","agentmail","AI代理的电子邮件基础设施。创建账户，发送\u002F接收电子邮件，管理Webhook，并通过AgentMail API检查Karma余额。","cat_coding_backend","mod_coding","sickn33,coding","---\nname: agentmail\ndescription: Email infrastructure for AI agents. Create accounts, send\u002Freceive emails, manage webhooks, and check karma balance via the AgentMail API.\nrisk: safe\nsource: community\n---\n\n# AgentMail — Email for AI Agents\n\nAgentMail gives AI agents real email addresses (`@theagentmail.net`) with a REST API. Agents can send and receive email, sign up for services (GitHub, AWS, Slack, etc.), and get verification codes. A karma system prevents spam and keeps the shared domain's reputation high.\n\nBase URL: `https:\u002F\u002Fapi.theagentmail.net`\n\n## When to Use\n- An AI agent needs a real inbox\u002Foutbox for signups, verification flows, or transactional communication.\n- You need to provision AgentMail accounts, send messages, read inbox contents, or register inbound webhooks.\n- You need to monitor karma usage or wire email events into agent automation.\n\n## Quick start\n\nAll requests require `Authorization: Bearer am_...` header (API key from dashboard).\n\n### Create an email account (-10 karma)\n\n```bash\ncurl -X POST https:\u002F\u002Fapi.theagentmail.net\u002Fv1\u002Faccounts \\\n  -H \"Authorization: Bearer am_...\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"address\": \"my-agent@theagentmail.net\"}'\n```\n\nResponse: `{\"data\": {\"id\": \"...\", \"address\": \"my-agent@theagentmail.net\", \"displayName\": null, \"createdAt\": 123}}`\n\n### Send email (-1 karma)\n\n```bash\ncurl -X POST https:\u002F\u002Fapi.theagentmail.net\u002Fv1\u002Faccounts\u002F{accountId}\u002Fmessages \\\n  -H \"Authorization: Bearer am_...\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"to\": [\"recipient@example.com\"],\n    \"subject\": \"Hello from my agent\",\n    \"text\": \"Plain text body\",\n    \"html\": \"\u003Cp>Optional HTML body\u003C\u002Fp>\"\n  }'\n```\n\nOptional fields: `cc`, `bcc` (string arrays), `inReplyTo`, `references` (strings for threading), `attachments` (array of `{filename, contentType, content}` where content is base64).\n\n### Read inbox\n\n```bash\n# List messages\ncurl https:\u002F\u002Fapi.theagentmail.net\u002Fv1\u002Faccounts\u002F{accountId}\u002Fmessages \\\n  -H \"Authorization: Bearer am_...\"\n\n# Get full message (with body and attachments)\ncurl https:\u002F\u002Fapi.theagentmail.net\u002Fv1\u002Faccounts\u002F{accountId}\u002Fmessages\u002F{messageId} \\\n  -H \"Authorization: Bearer am_...\"\n```\n\n### Check karma\n\n```bash\ncurl https:\u002F\u002Fapi.theagentmail.net\u002Fv1\u002Fkarma \\\n  -H \"Authorization: Bearer am_...\"\n```\n\nResponse: `{\"data\": {\"balance\": 90, \"events\": [...]}}`\n\n### Register webhook (real-time inbound)\n\n```bash\ncurl -X POST https:\u002F\u002Fapi.theagentmail.net\u002Fv1\u002Faccounts\u002F{accountId}\u002Fwebhooks \\\n  -H \"Authorization: Bearer am_...\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"url\": \"https:\u002F\u002Fmy-agent.example.com\u002Finbox\"}'\n```\n\nWebhook deliveries include two security headers:\n- `X-AgentMail-Signature` -- HMAC-SHA256 hex digest of the request body, signed with the webhook secret\n- `X-AgentMail-Timestamp` -- millisecond timestamp of when the delivery was sent\n\nVerify the signature and reject requests with timestamps older than 5 minutes to prevent replay attacks:\n\n```typescript\nimport { createHmac } from \"crypto\";\n\nconst verifyWebhook = (body: string, signature: string, timestamp: string, secret: string) => {\n  if (Date.now() - Number(timestamp) > 5 * 60 * 1000) return false;\n  return createHmac(\"sha256\", secret).update(body).digest(\"hex\") === signature;\n};\n```\n\n### Download attachment\n\n```bash\ncurl https:\u002F\u002Fapi.theagentmail.net\u002Fv1\u002Faccounts\u002F{accountId}\u002Fmessages\u002F{messageId}\u002Fattachments\u002F{attachmentId} \\\n  -H \"Authorization: Bearer am_...\"\n```\n\nReturns `{\"data\": {\"url\": \"https:\u002F\u002Fsigned-download-url...\"}}`.\n\n## Full API reference\n\n| Method | Path | Description | Karma |\n|--------|------|-------------|-------|\n| POST | `\u002Fv1\u002Faccounts` | Create email account | -10 |\n| GET | `\u002Fv1\u002Faccounts` | List all accounts | |\n| GET | `\u002Fv1\u002Faccounts\u002F:id` | Get account details | |\n| DELETE | `\u002Fv1\u002Faccounts\u002F:id` | Delete account | +10 |\n| POST | `\u002Fv1\u002Faccounts\u002F:id\u002Fmessages` | Send email | -1 |\n| GET | `\u002Fv1\u002Faccounts\u002F:id\u002Fmessages` | List messages | |\n| GET | `\u002Fv1\u002Faccounts\u002F:id\u002Fmessages\u002F:msgId` | Get full message | |\n| GET | `\u002Fv1\u002Faccounts\u002F:id\u002Fmessages\u002F:msgId\u002Fattachments\u002F:attId` | Get attachment URL | |\n| POST | `\u002Fv1\u002Faccounts\u002F:id\u002Fwebhooks` | Register webhook | |\n| GET | `\u002Fv1\u002Faccounts\u002F:id\u002Fwebhooks` | List webhooks | |\n| DELETE | `\u002Fv1\u002Faccounts\u002F:id\u002Fwebhooks\u002F:whId` | Delete webhook | |\n| GET | `\u002Fv1\u002Fkarma` | Get balance + events | |\n\n## Karma system\n\nEvery action has a karma cost or reward:\n\n| Event | Karma | Why |\n|---|---|---|\n| `money_paid` | +100 | Purchase credits |\n| `email_received` | +2 | Someone replied from a trusted domain |\n| `account_deleted` | +10 | Karma refunded when you delete an address |\n| `email_sent` | -1 | Sending costs karma |\n| `account_created` | -10 | Creating addresses costs karma |\n\n**Important rules:**\n- Karma is only awarded for inbound emails from trusted providers (Gmail, Outlook, Yahoo, iCloud, ProtonMail, Fastmail, Hey, etc.). Emails from unknown\u002Fthrowaway domains don't earn karma.\n- You only earn karma once per sender until the agent replies. If sender X emails you 5 times without a reply, only the first earns karma. Reply to X, and the next email from X earns karma again.\n- Deleting an account refunds the 10 karma it cost to create.\n\nWhen karma reaches 0, sends and account creation return HTTP 402. Always check balance before operations that cost karma.\n\n## TypeScript SDK\n\n```typescript\nimport { createClient } from \"@agentmail\u002Fsdk\";\n\nconst mail = createClient({ apiKey: \"am_...\" });\n\n\u002F\u002F Create account\nconst account = await mail.accounts.create({\n  address: \"my-agent@theagentmail.net\",\n});\n\n\u002F\u002F Send email\nawait mail.messages.send(account.id, {\n  to: [\"human@example.com\"],\n  subject: \"Hello\",\n  text: \"Sent by an AI agent.\",\n});\n\n\u002F\u002F Read inbox\nconst messages = await mail.messages.list(account.id);\nconst detail = await mail.messages.get(account.id, messages[0].id);\n\n\u002F\u002F Attachments\nconst att = await mail.attachments.getUrl(accountId, messageId, attachmentId);\n\u002F\u002F att.url is a signed download URL\n\n\u002F\u002F Webhooks\nawait mail.webhooks.create(account.id, {\n  url: \"https:\u002F\u002Fmy-agent.example.com\u002Finbox\",\n});\n\n\u002F\u002F Karma\nconst karma = await mail.karma.getBalance();\nconsole.log(karma.balance);\n```\n\n## Error handling\n\n```typescript\nimport { AgentMailError } from \"@agentmail\u002Fsdk\";\n\ntry {\n  await mail.messages.send(accountId, { to: [\"a@b.com\"], subject: \"Hi\", text: \"Hey\" });\n} catch (e) {\n  if (e instanceof AgentMailError) {\n    console.log(e.status);   \u002F\u002F 402, 404, 401, etc.\n    console.log(e.code);     \u002F\u002F \"INSUFFICIENT_KARMA\", \"NOT_FOUND\", etc.\n    console.log(e.message);\n  }\n}\n```\n\n## Common patterns\n\n### Sign up for a service and read verification email\n\n```typescript\nconst account = await mail.accounts.create({\n  address: \"signup-bot@theagentmail.net\",\n});\n\n\u002F\u002F Use the address to sign up (browser automation, API, etc.)\n\n\u002F\u002F Poll for verification email\nfor (let i = 0; i \u003C 30; i++) {\n  const messages = await mail.messages.list(account.id);\n  const verification = messages.find(m =>\n    m.subject.toLowerCase().includes(\"verify\") ||\n    m.subject.toLowerCase().includes(\"confirm\")\n  );\n  if (verification) {\n    const detail = await mail.messages.get(account.id, verification.id);\n    \u002F\u002F Parse verification link\u002Fcode from detail.bodyText or detail.bodyHtml\n    break;\n  }\n  await new Promise(r => setTimeout(r, 2000));\n}\n```\n\n### Send email and wait for reply\n\n```typescript\nconst sent = await mail.messages.send(account.id, {\n  to: [\"human@company.com\"],\n  subject: \"Question about order #12345\",\n  text: \"Can you check the status?\",\n});\n\nfor (let i = 0; i \u003C 60; i++) {\n  const messages = await mail.messages.list(account.id);\n  const reply = messages.find(m =>\n    m.direction === \"inbound\" && m.timestamp > sent.timestamp\n  );\n  if (reply) {\n    const detail = await mail.messages.get(account.id, reply.id);\n    \u002F\u002F Process reply\n    break;\n  }\n  await new Promise(r => setTimeout(r, 5000));\n}\n```\n\n## Types\n\n```typescript\ntype Account = { id: string; address: string; displayName: string | null; createdAt: number };\ntype Message = { id: string; from: string; to: string[]; subject: string; direction: \"inbound\" | \"outbound\"; status: string; timestamp: number };\ntype MessageDetail = Message & { cc: string[] | null; bcc: string[] | null; bodyText: string | null; bodyHtml: string | null; inReplyTo: string | null; references: string | null; attachments: AttachmentMeta[] };\ntype AttachmentMeta = { id: string; filename: string; contentType: string; size: number };\ntype KarmaBalance = { balance: number; events: KarmaEvent[] };\ntype KarmaEvent = { id: string; type: string; amount: number; timestamp: number; metadata?: Record\u003Cstring, unknown> };\n```\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,193,1094,"2026-05-16 13:01:34",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"851bd7c7-b0e0-456b-b4a6-4ce937036e3c","1.0.0","agentmail.zip",3368,"uploads\u002Fskills\u002F0e692314-fcf5-4383-a2d2-38f2da95f97e\u002Fagentmail.zip","e8abfd5916c4d4d44cb9499a98b9fec0fd185cc80032e94700ba2923510a4c37","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":8903}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]