---
title: Agent Email
description: Dedicated email addresses for AI agents — send, receive, and manage email programmatically
---

# Agent Email

Every Agnic agent gets a dedicated email address (`agent-{id}@agent.agnic.ai`) that works across CLI, MCP tools, and the API. Agents can send emails, receive replies, check their inbox, and sign up for services — all programmatically.

---

## How It Works

1. **Agent onboards** via API key creation or OAuth flow
2. **Email alias auto-created** as `agent-{id}@agent.agnic.ai`
3. **Outbound**: agent sends email via Resend
4. **Inbound**: replies arrive via webhook and are stored in the agent's inbox
5. **Retention**: messages are kept for 30 days, then automatically cleaned up

---

## Access Methods

| Method | Use Case |
|--------|----------|
| **CLI** (`agnic email`) | Developer testing, scripts, automation |
| **MCP Tools** (`check_agent_email`, `send_agent_email`, `reply_agent_email`) | AI assistants (Claude, ChatGPT, n8n) |
| **REST API** (`/api/agent/email/*`) | Custom integrations, backends |

---

## API Endpoints

| Endpoint | Method | Auth | Description |
|----------|--------|------|-------------|
| `/api/agent/email` | GET | authenticateFlexible | Get agent's email alias info |
| `/api/agent/email` | POST | authenticateFlexible | Create email alias (idempotent) |
| `/api/agent/email/inbox` | GET | authenticateFlexible | Fetch inbox messages |
| `/api/agent/email/send` | POST | authenticateFlexible | Send email from agent address |
| `/api/agent/email/reply` | POST | authenticateFlexible | Reply to an inbox message |
| `/webhook/email/inbound` | POST | Svix signature | Receive inbound emails (Resend webhook) |

---

## Quick Start

```bash
# 1. Set up email alias
npx agnic@latest email setup --display-name "My Agent"

# 2. Send an email
npx agnic@latest email send \
  --to user@example.com \
  --subject "Hello" \
  --body "This is from my AI agent"

# 3. Check inbox for replies
npx agnic@latest email inbox --json
```

---

## Example: Sign Up + Verify + Report

```bash
# Agent signs up for a service
npx agnic@latest email send \
  --to signup@api-provider.com \
  --subject "API Access Request" \
  --body "Please create an account for agent-396@agent.agnic.ai"

# Check for verification email
npx agnic@latest email inbox --limit 5 --json

# Reply to confirm
npx agnic@latest email reply \
  --message-id aem_... \
  --body "Confirmed"

# Email results to user
npx agnic@latest email send \
  --to user@company.com \
  --subject "API Key Ready" \
  --body "Your API key has been activated"
```

---

## Inbound Email Setup

Inbound email requires DNS and webhook configuration (already configured for `agent.agnic.ai`):

| Record | Type | Value |
|--------|------|-------|
| MX | `agent.agnic.ai` | Resend inbound SMTP |
| Webhook | `https://api.agnic.ai/webhook/email/inbound` | `email.received` events |

Webhook signatures are verified using the [Svix](https://www.svix.com/) library as recommended by Resend.

---

## Next Steps

<Cards>
  <Card title="Agent Email Skill" href="/docs/agentic-wallet/skills/agent-email">
    Use email via AI skills
  </Card>
  <Card title="MCP Server" href="/docs/agnicpay-features/mcp-server">
    Use email tools via MCP
  </Card>
  <Card title="API Reference" href="/docs/api-reference/agent-email">
    Full API documentation
  </Card>
</Cards>
