AgentMail Skill
AgentMail gives an agent its own email inbox for sending mail, receiving
replies, completing email OTP flows, and running inbound email loops. Use it for
agent-owned inboxes, not a user's existing IMAP/SMTP mailbox.
Use the agentmail CLI first. Use MCP only when the harness expects MCP tools;
use REST only when the CLI is missing a required operation.
When to Use
- The agent needs an email address it owns.
- The task involves email OTP flows, replies, threads, labels, or attachments.
- The agent needs webhook or WebSocket delivery for inbound mail.
Prerequisites
- Run commands through the
terminal tool.
- Install the CLI:
npm install -g agentmail-cli@latest
export AGENTMAIL_API_KEY="am_..."
No API key yet? Use signup.md.
How to Run
Use --format json whenever another command or script needs IDs.
agentmail inboxes list --format json
Quick Reference
- AgentMail agent reference: hosted copy.
- AgentMail: product landing page.
- Console: API keys and account management.
- Docs: full product documentation.
- signup.md: self-signup and OTP verification.
- core.md: inboxes, messages, threads, labels, attachments.
- webhooks.md: events to a public HTTPS server.
- websockets.md: events to a local agent process.
- mcp.md: MCP integration.
Procedure
- Install
agentmail-cli@latest and verify agentmail inboxes list --format json.
- If no API key is available, complete signup.md.
- Use core.md for inbox, send, read, reply, forward,
label, thread, and attachment flows.
- Add webhooks.md or
websockets.md only when polling is not enough.
Pitfalls
- Prefer
AGENTMAIL_API_KEY over --api-key.
- Never expose
AGENTMAIL_API_KEY in prompts, logs, URLs, or committed files.
- Use stable
client_id values for retried create operations.
- Prefer
extracted_text or extracted_html for LLM input when present.
- React to
message.received, not messages the agent sent.
Verification
agentmail inboxes list --format json
1---2name: agentmail3description: Use when an agent needs AgentMail CLI email inboxes.4version: 1.0.05author: Haakam Aujla (Haakam21), AgentMail6license: MIT7platforms: [linux, macos, windows]8metadata:9 loki:10 tags: [Email, CLI, AgentMail, Communication]11 homepage: https://agentmail.to12prerequisites:13 commands: [agentmail]14required_environment_variables:15 - name: AGENTMAIL_API_KEY16 prompt: AgentMail API key (starts with am_)17 help: "Create one at https://console.agentmail.to — or run the CLI self-signup flow in references/signup.md to obtain a key without one."18 required_for: "authenticating the agentmail CLI; not needed before self-signup"19 optional: true20---2122# AgentMail Skill2324AgentMail gives an agent its own email inbox for sending mail, receiving25replies, completing email OTP flows, and running inbound email loops. Use it for26agent-owned inboxes, not a user's existing IMAP/SMTP mailbox.2728Use the `agentmail` CLI first. Use MCP only when the harness expects MCP tools;29use REST only when the CLI is missing a required operation.3031## When to Use3233- The agent needs an email address it owns.34- The task involves email OTP flows, replies, threads, labels, or attachments.35- The agent needs webhook or WebSocket delivery for inbound mail.3637## Prerequisites3839- Run commands through the `terminal` tool.40- Install the CLI:4142```bash43npm install -g agentmail-cli@latest44```4546- Export an API key:4748```bash49export AGENTMAIL_API_KEY="am_..."50```5152No API key yet? Use [signup.md](references/signup.md).5354## How to Run5556Use `--format json` whenever another command or script needs IDs.5758```bash59agentmail inboxes list --format json60```6162## Quick Reference6364- [AgentMail agent reference](https://agentmail.md): hosted copy.65- [AgentMail](https://agentmail.to): product landing page.66- [Console](https://console.agentmail.to): API keys and account management.67- [Docs](https://docs.agentmail.to): full product documentation.68- [signup.md](references/signup.md): self-signup and OTP verification.69- [core.md](references/core.md): inboxes, messages, threads, labels, attachments.70- [webhooks.md](references/webhooks.md): events to a public HTTPS server.71- [websockets.md](references/websockets.md): events to a local agent process.72- [mcp.md](references/mcp.md): MCP integration.7374## Procedure75761. Install `agentmail-cli@latest` and verify `agentmail inboxes list --format json`.772. If no API key is available, complete [signup.md](references/signup.md).783. Use [core.md](references/core.md) for inbox, send, read, reply, forward,79 label, thread, and attachment flows.804. Add [webhooks.md](references/webhooks.md) or81 [websockets.md](references/websockets.md) only when polling is not enough.8283## Pitfalls8485- Prefer `AGENTMAIL_API_KEY` over `--api-key`.86- Never expose `AGENTMAIL_API_KEY` in prompts, logs, URLs, or committed files.87- Use stable `client_id` values for retried create operations.88- Prefer `extracted_text` or `extracted_html` for LLM input when present.89- React to `message.received`, not messages the agent sent.9091## Verification9293```bash94agentmail inboxes list --format json95```