Solutions
Aiemail — AI Email Infrastructure for Agents
Aiemail is email designed for AI agents rather than human inboxes: each agent gets its own address, its own reputation context, and structured access to inbound replies. Mails.ai provides aiemail infrastructure as an API — send with one call, receive replies as parsed JSON events, and keep every agent's sending identity isolated so one agent's behavior can't affect another's deliverability.
What aiemail infrastructure looks like
Traditional email was built for one-to-one human communication. Marketing platforms added volume sending. Neither model fits an AI agent that needs to send a notification, read the reply, decide what to say next, and do this across hundreds of parallel conversations — each from a distinct, authenticated identity.
Aiemail flips the model: the email address is the agent's identity, not the company's. When an agent at support@yourapp.com sends a follow-up, it's not a blast from a shared pool — it's a message from that agent's own reputation context, which lives or dies by that agent's behavior. The reply comes back as structured JSON, not raw MIME, so the agent can act on it without parsing.
Three things every aiemail setup needs
Regardless of which framework your agents run on, aiemail infrastructure needs to cover three things:
- Per-agent addresses and reputation isolation — one agent's high send volume or bounce rate should not affect another agent. This requires per-agent sending contexts, not a shared pool.
- Structured inbound parsing — agents can't reliably parse raw MIME. Replies need to arrive as events with extracted fields: sender, subject, body text, threading references, and attachment metadata.
- Prompt-injection scanning — inbound email from untrusted senders is an attack surface. Any message that reaches an agent's context window should be scanned for injection attempts before the agent acts on it.
# Provision an aiemail address for an agent
curl https://api.mails.ai/v1/addresses \
-H "Authorization: Bearer $MAILS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"agent": "support", "domain": "yourapp.com"}'
# → { "address": "support@yourapp.com", "agent": "support" }
# Send an email from that agent
curl https://api.mails.ai/v1/messages \
-H "Authorization: Bearer $MAILS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent": "support",
"to": "customer@example.com",
"subject": "Your ticket is resolved",
"body_text": "We closed ticket #4821. Reply here if anything else comes up."
}'
# Inbound replies arrive as webhook events — structured, injection-scanned
# {
# "event": "message.received",
# "agent": "support",
# "from": "customer@example.com",
# "subject": "Re: Your ticket is resolved",
# "body_text": "Thanks — one more thing actually...",
# "thread_id": "thr_abc123",
# "injection_scan": { "clean": true }
# }MCP-native aiemail for Claude and Cursor agents
Agents running inside MCP clients — Claude Desktop, Cursor, or any other MCP-enabled environment — can use the Mails.ai MCP server to send and receive email without writing any integration code. The server exposes mails_send, mails_list, and mails_get tools that the agent can call directly from its tool use loop.
// claude_desktop_config.json — add the Mails.ai MCP server
{
"mcpServers": {
"mails": {
"command": "npx",
"args": ["-y", "@mails-ai/mcp"],
"env": { "MAILS_API_KEY": "your_key_here" }
}
}
}Once the server is configured, any Claude or Cursor agent in that session can send and read email through tool calls. Each send goes from the agent's provisioned address with full DKIM and SPF authentication — no shared pool, no reputation bleed from other agents.
Frequently asked questions
What does aiemail actually mean?
Aiemail refers to email infrastructure designed for AI agents — not email marketing, not a human inbox, but a programmable address an agent uses to send notifications, read replies, and continue a conversation thread. The distinction matters: an agent needs per-address reputation isolation, structured inbound parsing, and prompt-injection scanning on replies. A standard SMTP relay provides none of these.
How is aiemail different from a regular email API?
A standard transactional email API is designed for one-directional sends at volume from a shared pool. Aiemail is bidirectional: each agent owns a separate address, inbound replies come back as structured JSON events rather than raw MIME, and the reputation of each agent's sending identity is tracked independently so a noisy agent can be rate-limited without affecting others. Mails.ai also runs prompt-injection scanning on every inbound message before it reaches your agent.
Which AI agents and frameworks work with Mails.ai aiemail?
Any agent that can make an HTTP request works with the REST API. There are first-party SDKs for Node.js and Python. For MCP-native agents (Claude Desktop, Cursor, or anything running an MCP client), the Mails.ai MCP server exposes send, receive, and list tools that agents can call directly without writing any integration code.
What does aiemail infrastructure cost on Mails.ai?
The Metered tier has no monthly minimum: $0.001 per outbound message, $0.002 per inbound reply, and $0.003 per inbound if you want the prompt-injection classifier to run. Pro tier is $20/month for 50K sends and 50K inbound events. The Free tier allows 3,000 events per month for evaluation. There is no per-seat charge and no setup fee.
Explore the product
Built for agents.
Self-serve in minutes.
The API is live and self-serve. Drop ~6 lines into your agent and ship.
$ npm install @mailsai/sdk