Skip to content
Blog / Developer Resources

AgentMail vs Mailgun

Binoy Perera

Updated

Mailgun is a transactional email API with a catch-all route and short-window MIME retention. AgentMail is built around the inbox as the primitive for AI agents, with framework connectors, prompt-injection defenses, and BYOC deployment. Here is what each one is built for, the agent loop in code, and how the routing, retention, threading, security, and pricing compare.

  • comparison
  • mailgun
  • agent-infrastructure
  • email-api
  • ai-agents

TL;DR

Mailgun is a transactional email API with a routes-based inbound system and a 50-plus tool MCP server. Inbound MIME retention is 0 to 7 days depending on plan. There is no inbox object.

AgentMail is built around the inbox as the primitive: one API call gives an agent its own inbox with persistent storage, automatic threading, real-time events over webhooks and WebSockets, per-inbox API keys, and multi-tenant Pods. On top of that primitive, AgentMail ships framework connectors (LangChain, CrewAI, LlamaIndex, LiveKit), an official OpenClaw plugin, prompt-injection defenses under Agent Armor, and BYOC deployment via Outposts.

Send-heavy workloads: Mailgun. Agent inbox workloads: AgentMail.

When Mailgun is the right call

  • The workload is send-heavy or send-only: transactional notifications, password resets, receipts, marketing broadcasts at high volume.
  • You need email validation before sending to reduce bounce rates without a separate third-party service.
  • You want the deepest inbound routing on the market: regex-matched routes, conditional forwarding, and route composition inside a single verified domain.
  • You need mature template management, mailing lists, batch sending, and campaign analytics on the marketing side, features Mailgun has iterated on for over a decade.
  • The team is comfortable with a routes-plus-webhooks model and is ready to build the address-to-agent mapping, tenant isolation, threading, and durable message store on top.
  • Multi-region data residency (EU or US) is a hard requirement, and Mailgun's regional endpoints fit your compliance shape.

When AgentMail is the right call

  • The agent needs its own email identity: a real, addressable inbox with API-scoped credentials, not a from address on a shared sender or a matched local part on a catch-all route.
  • Each agent or tenant needs a scoped identity: own address, own API key, isolated data via Pods.
  • The agent uses email as long-term memory, so it needs a real, queryable inbox rather than a stream of past webhook deliveries that disappears after 7 days.
  • The product provisions inboxes per customer at signup and needs the operation to be a single API call, not a route configuration plus an application-side registry.
  • Your agent runs on LangChain, CrewAI, LlamaIndex, LiveKit, or OpenClaw and you want a first-party connector instead of a raw HTTP client.
  • The agent reads and replies in-thread across many concurrent conversations, and threading needs to work without your code assembling In-Reply-To and References headers on every send.
  • You need prompt-injection defense on inbound: per-inbox allowlists and blocklists, scoped API keys that limit blast radius, and the Agent Armor guardrails on top.
  • You need enterprise deployment options like BYOC (Outposts) that run the email side of AgentMail inside your own AWS account, or EU region hosting for data residency.
  • The agent needs to provision its own email capability autonomously, without a human completing the signup flow first (agent-initiated signup via x402).

What each one is built for

Mailgun is a transactional and marketing email API for developers. The send side is the core product: Email API, SMTP relay, template management with versioning, batch sending, bulk campaigns, analytics, mailing lists, dedicated IPs, an email validation API, and a 50-plus tool MCP server that exposes most of the surface to AI coding agents. Mailgun's deepest differentiator on inbound is the Routes API: on a verified domain, you configure regex-matched routes that trigger actions like forward() to a URL, store() in Mailgun-hosted storage, or stop() to end further processing. A catch_all() route accepts any local part on the domain, so you can receive at anything@yourdomain.com without creating anything ahead of time.

There is no inbox object. There is no thread model. There is no per-address provisioning API. Routes are declarative configuration, not resources you create per agent. When a message arrives, Mailgun fires a webhook to your endpoint (or drops the MIME into storage for a short window), and the mapping from address to agent, the deprovisioning path, and the durable store are yours to build.

The inbox is the API object here. An Inbox carries an address on the shared @agentmail.to domain or on a domain you verify, keeps its own messages, threads them from the In-Reply-To and References headers, pushes new mail over webhooks or a WebSocket, and lives in a Pod that separates tenants at the infrastructure level. On top of that primitive, AgentMail ships tested first-party connectors for the major agent orchestration frameworks (LangChain, LlamaIndex, CrewAI, LiveKit), an official OpenClaw plugin on ClawHub, an MCP server, and an Agent Skill file for AI coding assistants. Provisioning an inbox is client.inboxes.create(). Replying in-thread is client.inboxes.messages.reply(). The Quickstart walks through the full send-and-receive loop.

The agent loop

Step in the agent loopMailgunAgentMail
Provision a new mailboxNot supported. catch_all() accepts any local part on a domain; no inbox objectNative (one API call)
Send outbound messageNative (REST API or SMTP)Native
Receive inbound messageNative (webhook via a route; MIME optionally stored 0-7 days depending on plan)Native (webhook, WebSocket)
Thread reply against conversationCustomer-built; parse Message-Id, set In-Reply-To and References headers manuallyBuilt in (messages.reply with message_id)
Store conversation history0 days Free, 1 day Foundation, up to 7 days Scale/Enterprise (default 3)Persistent on every plan
Stable identity per agentAddress on your verified domain, matched by a route; no inbox objectInbox is the identity
Multi-tenant isolationSubaccounts segment sending programs and IP pools; you build per-tenant routingInbox Pods with scoped API keys
Event routing per identityOne webhook per route; per-agent routing is application codeScoped webhooks per pod or per inbox
Framework connectorsNone; HTTP API works with any frameworkLangChain, LlamaIndex, CrewAI, LiveKit
Official orchestrator pluginNoneOfficial OpenClaw plugin on ClawHub
MCP for AI coding agentsOfficial (50+ tools, send-centric)Official + AgentMail Skill for Claude Code, Cursor
Agent-initiated signupNot supportedSupported via x402
Prompt-injection defensesNot nativePer-inbox allowlists/blocklists + Agent Armor guardrails
BYOC / self-hostedNot offered as a public optionOutposts (Enterprise): runs in your AWS

Where the products diverge

Mailgun's routes system is powerful. Regex-matched routes let you filter inbound by sender pattern, subject match, or destination address, and compose multiple actions in sequence. No transactional email API in the same category ships this depth of routing.

A route is a rule that fires when a message arrives. An inbox is a resource with an identity, a persistent history, a thread model, a scoped credential, and a set of behaviors an agent can invoke without your code assembling the plumbing. For a workflow like reply-by-email comment posting or a support ticket pipeline where each incoming message is a discrete event and your application already owns the durable store, Mailgun's routes are a strong fit. For agents that hold a conversation over days or weeks, or platforms that provision an addressable identity per tenant at signup and reason about that identity later, the inbox layer has to be built on top.

Mailgun documents its MIME storage window at 0 days on Free, 1 day on Foundation, and up to 7 days on Scale and Enterprise with a default of 3 when a domain is created. The raw message body only exists on Mailgun's side for a few days at most. If your agent needs to reference an inbound message from last month, or your handler failed and you want to replay, the MIME is already gone. Your application has to persist the body during the webhook window or lose it.

AgentMail persists message history on every plan, including Free. The Get a message endpoint returns decoded HTML and text bodies plus raw .eml access, and the inbox doubles as a durable message store the agent can query later. Replies thread automatically through messages.reply without your code building the In-Reply-To and References headers. Drafts support human-in-the-loop approvals for sensitive sends.

Agent-native features Mailgun doesn't have

Beyond the inbox primitive, AgentMail ships a set of capabilities that only make sense once the underlying platform is agent-native. Mailgun does not offer equivalents because they are outside the scope of a transactional email API.

Agent-initiated signup via x402. An AI agent can complete its own AgentMail signup and pay for the service autonomously via x402, the open payment protocol from Coinbase. An agent can provision its own account, get an API key, install the SDK, create an inbox, and start sending and receiving mail as part of one autonomous workflow. Mailgun (and every other transactional email API in the category) requires a human to complete the signup flow before an API key exists.

Framework connectors. First-party integrations for LangChain, CrewAI, LlamaIndex, and LiveKit. If your agent runs on one of those frameworks, the email layer is a first-class tool, not a raw HTTP client you wire yourself. Mailgun's HTTP API works with any framework but ships no framework-specific connectors.

Official OpenClaw plugin. AgentMail is on ClawHub as an official OpenClaw plugin. It ships a CLI-backed AgentMail Skill plus an email channel: inbound mail drives an agent turn and the agent replies in the thread, with a default-deny sender allowlist. Install with one command. Mailgun is not an official plugin for any agent orchestrator.

Email as agent memory. Because inbox history is persistent on every plan and messages are grouped into threads, the inbox doubles as a long-term memory layer the agent can query semantically. Past conversations, verification codes, receipts, and attachments remain addressable months later. On Mailgun the memory horizon is bounded by the 7-day MIME retention ceiling plus whatever you build on top.

Semantic search across inboxes. Query messages across every inbox in your organization by meaning rather than keyword. Useful when an agent needs to recall a past communication or reason across many identities. Mailgun does not offer a semantic search surface.

Structured data extraction. Pull structured data out of unstructured messages: invoices, receipts, order confirmations, verification codes. The extraction runs on the inbox rather than as a separate pipeline your application maintains.

Automatic labeling. Categorize incoming mail with user-defined prompts. The label is applied at ingest, so downstream agent routing can dispatch on category instead of parsing subject lines with regex.

Security: prompt injection defense on inbound

For agents that process inbound email, any user or automated sender can put untrusted content into a subject line, body, or attachment, and that content flows straight into the model's context. The EchoLeak vulnerability in Microsoft 365 Copilot (CVE-2025-32711) was disclosed in June 2025 and worked exactly this way: hidden instructions inside an email, exfiltrated data through a rendered image URL.

Mailgun's inbound is a pass-through: the webhook delivers the raw MIME to your handler and defense against untrusted content is entirely your application's responsibility.

AgentMail ships defenses at the inbox layer:

  • Per-inbox allowlists and blocklists. Filter senders before messages reach the agent. Combined with a default-deny posture on high-trust inboxes, this eliminates whole categories of injection attempts at ingest.
  • Per-inbox API keys. Scoped credentials mean a compromise in one inbox cannot affect another. Even if an injected instruction convinces an agent to act, the blast radius is one inbox rather than the whole account.
  • Agent Armor screening. Inbound screening layered on top of the allowlist and API scoping. Rules catch hidden signals and a model reads the whole message for intent, so a message that would steer an agent is held for review rather than passed through. Screening runs after receipt, never in front of your MX record.
  • Pod-level isolation. For multi-tenant deployments, a Pod isolates one customer's inboxes, credentials, and event streams from another's. An injection that lands inside Tenant A's Pod cannot reach Tenant B.

Per-inbox scoped credentials only work because inboxes are first-class resources. Per-tenant Pod isolation only works because inboxes group into Pods. On a routes-plus-webhooks architecture, the equivalents are code you write, keep correct, and audit against the OWASP Top 10 for Agentic Applications yourself.

MCP and framework integrations

Mailgun ships an official MCP server that exposes over 50 tools across the full Mailgun API surface: sending, receiving, domain management, DNS troubleshooting, webhooks, routes, mailing lists, templates, analytics, subaccounts, email validation, and unsubscribes. Setup is npx-based. The design keeps API keys in environment variables so credentials never pass to the model. The shape of the surface is send-centric because that is what Mailgun is; there is no inbox tool because there is no inbox resource.

AgentMail ships an official MCP server at https://mcp.agentmail.to/mcp and an open-source AgentMail Skill for AI coding agents. Install the skill with npx skills add agentmail-to/agentmail-skills and an agent gets first-class knowledge of the full AgentMail surface: provisioning Inboxes on demand, sending and replying to Messages inside Threads, managing Drafts for human-in-the-loop approvals, isolating tenants with Pods, handling Attachments, applying idempotency keys for safe retries, and subscribing to real-time events over WebSockets or webhooks.

Beyond the MCP and Skill, AgentMail ships first-party framework connectors for LangChain, LlamaIndex, CrewAI, and LiveKit, and an official OpenClaw plugin on ClawHub. If your agent runs on one of those frameworks or on OpenClaw, the email layer arrives as a tested integration rather than a raw HTTP client you wire yourself. Mailgun does not ship framework connectors for any of these, and is not an official plugin for any agent orchestrator.

Deployment options: managed, EU region, and BYOC (Outposts)

Mailgun offers managed deployment with US and EU regional endpoints. That covers the common data-residency requirements for teams in Europe. Self-hosting or bring-your-own-cloud is not publicly offered.

AgentMail offers:

  • Managed hosting on the standard multi-tenant infrastructure (all plans).
  • EU region hosting for data residency (Enterprise).
  • Outposts, a bring-your-own-cloud deployment that runs the email side of AgentMail inside the customer's own AWS account (Enterprise). Outposts is aimed at teams that need the raw MIME to never leave an account they control, whether for compliance, contractual, or sovereignty reasons.
  • SAML SSO on Enterprise for identity and access management.

For teams whose email infrastructure has to sit inside their own cloud boundary for legal or contractual reasons, Outposts is the differentiator. Building an equivalent on Mailgun means self-hosting a separate mail platform (Postfix, Haraka, or a custom SES layer) and losing the vendor entirely.

Pricing

Mailgun

PlanPriceEmails/monthMIME retentionInbound routes
Free$0100/day (~3,000)0 daysYes
Foundation$35/month50,0001 dayYes
Scale$90/month100,000Up to 7 days (def. 3)Yes
EnterpriseFrom $1,500/mo2.5M+Up to 7 days (def. 3)Yes

On Mailgun's pricing page, dedicated IPs are an add-on and email validation is billed separately from send volume. Mailgun's pay-as-you-go Flex rate doubled from $1.00 to $2.00 per 1,000 emails on December 1, 2025 with minimal advance notice, a change that generated significant discussion in developer communities.

AgentMail

PlanPriceInboxesSend limitsRetention
Free$03100/day; no separate 5-minute or monthly capPersistent
Developer$20/month10100/5 min; 1,000/day; 10,000/monthPersistent
Startup$200/month1501,500/5 min; 15,000/day; 150,000/monthPersistent
EnterpriseCustomCustomCustomPersistent

Enterprise carries the dedicated IPs (contact sales), Outposts (BYOC), EU region hosting, and SAML. Startup and above get the SOC 2 Type II report. Retention is persistent on every plan, and the full list is at agentmail.to/pricing.

A note on comparing these numbers

At the entry paid tier Mailgun's $35 Foundation gets you 50,000 emails with 1-day MIME retention and no inbox layer. AgentMail's $20 Developer gets you 10 inboxes with full send and receive, persistent storage, automatic threading, Pods, and the inbox primitive. For send-only workloads at high volume, Mailgun's per-email cost scales lower than AgentMail's per-inbox cost. For workloads that need persistent agent inboxes, framework integrations, or prompt-injection defense on inbound, the comparison is the AgentMail surface versus building each of those layers on top of Mailgun yourself.

The Flex rate change in December 2025 also shifted the low-volume economics. Side projects and small-scale AI agent workloads that were priced against the old $1.00 per 1,000 Flex rate saw a 100% overnight increase. Worth factoring in if your workload sits below the Foundation plan and above the Free tier's daily cap.

What an AgentMail subscription covers that Mailgun doesn't

Building a working receive pipeline on Mailgun means a webhook handler that catches the route delivery, a database to persist message bodies before Mailgun's 3-day (or 1-day, or 0-day) MIME window closes, threading logic that reconstructs conversations from Message-Id, In-Reply-To, and References headers, and per-tenant routing on a shared inbound endpoint. Before any of that, you need domain verification, MX record configuration, and a catch_all() route with your local-part mapping logic. That only gets you the plumbing; the memory layer, semantic search, structured data extraction, prompt-injection defense, framework connectors, and agent-initiated signup are separate builds on top.

AgentMail collapses the plumbing to one API call. client.inboxes.create() returns an inbox with an addressable identity, a persistent store, automatic threading, and a scoped API key. Per-tenant isolation is a Pod, not a code path. Threading is a method call on the inbox, not a header assembly step in your handler. Framework integration is an installed connector, not a hand-rolled HTTP client. The agent-native surface on top (semantic search, structured data extraction, automatic labeling, prompt-injection defense via Agent Armor, and x402 self-serve signup) is part of the platform, not code you write and maintain.

Every agent on a Mailgun domain shares one event stream, differentiated by whichever local part matched the route. On AgentMail, each inbox is its own address with its own API key and scoped credentials. Scoped webhooks route events for a specific pod or a specific inbox to the right endpoint, instead of one organization-level firehose your application has to sort.

Mailgun's per-domain rate limits are structured around send volume. If you are running many agents under one Mailgun account, they share the same domain reputation and event stream. AgentMail's limits are per-inbox, and the sender reputation is scoped per inbox and per domain, so one misbehaving agent cannot burn the reputation of the fleet.

Code: the full agent loop

AgentMail

Python

import osfrom dotenv import load_dotenvfrom agentmail import AgentMailfrom agentmail.inboxes.types import CreateInboxRequestload_dotenv()client = AgentMail(api_key=os.getenv("AGENTMAIL_API_KEY"))# Provision the agent's inbox in one callinbox = client.inboxes.create(    request=CreateInboxRequest(username="sales-agent"))# Send outboundclient.inboxes.messages.send(    inbox_id=inbox.inbox_id,    to="lead@example.com",    subject="Quick question",    text="Hi Alex, saw your post about email infrastructure...",)# Reply in-thread when a message.received webhook firesdef on_inbound_email(payload):    message_id = payload["message"]["message_id"]    client.inboxes.messages.reply(        inbox_id=inbox.inbox_id,        message_id=message_id,        text="Thanks for getting back. To answer your question...",    )

Mailgun

Python

import osimport requestsMG_API_KEY = os.environ["MAILGUN_API_KEY"]MG_DOMAIN = os.environ["MAILGUN_DOMAIN"]# Send outbound through the Mailgun Messages APIrequests.post(    f"https://api.mailgun.net/v3/{MG_DOMAIN}/messages",    auth=("api", MG_API_KEY),    data={        "from": f"sales-agent@{MG_DOMAIN}",        "to": "lead@example.com",        "subject": "Quick question",        "text": "Hi Alex, saw your post about email infrastructure...",    },)# One-time setup: create a catch_all route that forwards to your webhook.# Every inbound message for the domain now lands on one endpoint,# and your application dispatches by inspecting the recipient field.requests.post(    "https://api.mailgun.net/v3/routes",    auth=("api", MG_API_KEY),    data={        "priority": "0",        "description": "Catch-all to app webhook",        "expression": f"catch_all()",        "action": [            f"forward('https://yourapp.example/mg/inbound')",            "store()",            "stop()",        ],    },)# Inbound mail arrives at your webhook endpoint as multipart form data.# You get the MIME for as few as 0 days (Free) or up to 7 days (Scale/Enterprise).def on_inbound_email(payload):    recipient = payload.get("recipient")      # who was it addressed to    sender = payload.get("sender")    subject = payload.get("subject")    body = payload.get("stripped-text")       # cleaned reply text    message_id = payload.get("Message-Id")    # header you build In-Reply-To from    # Dispatch to the right agent yourself: parse the local part,    # look up the tenant, load the thread state from your database.    agent = lookup_agent_by_local_part(recipient)    thread = load_or_create_thread(agent, message_id)    # Build a threaded reply manually    requests.post(        f"https://api.mailgun.net/v3/{MG_DOMAIN}/messages",        auth=("api", MG_API_KEY),        data={            "from": recipient,   # send from the address that was hit            "to": sender,            "subject": f"Re: {subject}",            "text": "Thanks for getting back...",            "h:In-Reply-To": message_id,            "h:References": " ".join(thread.reference_chain + [message_id]),        },    )    # Persist the message before Mailgun's MIME window closes    save_message(agent, thread, payload)

The Mailgun code works. What it carries with it is the local-part parsing, the address-to-agent mapping, the thread reconstruction from RFC 5322 headers, the persistence layer, and the tenant isolation. All of that is code you write and maintain.

Identity, multi-tenancy, and self-serve agent signup

Mailgun's identity unit is a domain plus its routes. Subaccounts exist as a segmentation primitive for sending programs and IP pools, but the address that a message arrives at is a local part on a domain matched by a route. Multi-tenant isolation means writing per-tenant routing logic on a shared inbound endpoint, running separate subaccounts for reputation isolation, and building a per-tenant durable store.

On AgentMail the Inbox is the unit of identity. Inboxes live in Pods, Pods keep tenants apart at the infrastructure level, and keys scope to a pod or a single inbox, so one tenant's leaked credential cannot read another tenant's mail. An inbox for a new customer is one call at signup. Scoped webhooks send events for a specific pod or a specific inbox to their own endpoint, so your application handler isn't sorting through the whole organization's mail stream.

For fully autonomous agents that need to bootstrap their own tooling without a human in the loop, AgentMail supports agent-initiated signup via x402: an agent can complete signup, pay for a plan, get an API key, and provision inboxes on its own. Mailgun requires a human to complete the signup flow before an API key exists, which is the correct default for most business accounts but a hard blocker for autonomous agent workflows that provision infrastructure at runtime.

Migrating from Mailgun to AgentMail

Teams that started on Mailgun for outbound and added inbound through routes often end up building an inbox layer on top: a database for messages, a catch_all() route with a webhook handler, per-agent routing on the local part, and a threading job that reconstructs conversations from headers. The AgentMail migration replaces that custom layer with a real Inbox object.

Outbound is the smaller change. POST /v3/{domain}/messages on Mailgun becomes client.inboxes.messages.send on AgentMail (see the Quickstart). Inbound is the larger change: the catch_all() route plus webhook plus database plus threading code gets replaced by per-inbox provisioning, the message.received event, and client.inboxes.messages.reply for threaded replies. Mailgun and AgentMail can run side-by-side during the transition, with Mailgun continuing to handle high-volume outbound or complex regex-based routing and AgentMail handling the agent inbox surface.

For teams primarily on Mailgun for email validation before sending, that surface can stay on Mailgun independently. AgentMail focuses on the inbox side of the problem and interoperates with any pre-send validation layer.

Choosing between them

Both work for what they're built for. Pick Mailgun if your workload is send-first and you're ready to build the inbox layer on top yourself. Pick AgentMail if your workload is inbox-first and you want the platform to handle threading, persistence, per-agent identity, framework integration, prompt-injection defense, and (if you need it) BYOC deployment.

The Free plan provisions real inboxes with full sending and receiving. No credit card required.

New to agent email? Start with the complete guide →

New to agent email? Start with the complete guide.

FAQ

Questions, answered.

No. Mailgun accepts inbound at a verified domain and matches incoming mail against regex routes you configure. A catch_all() route accepts any local part on the domain, which lets you receive at unlimited addresses without creating anything ahead of time, but there is no inbox resource, no thread object, and no per-address provisioning API. Your application owns the mapping from address to agent.

A catch_all route is a rule that fires when mail arrives at any local part on a verified domain. It accepts the message and executes actions like forwarding to a webhook, storing in Mailgun-hosted storage for a short window, or stopping further processing. An inbox is a resource with an identity: its own address, its own scoped API key, a persistent message store, an automatic thread model, and per-inbox event routing. Routes give you unlimited addresses; inboxes give you unlimited addressable identities with state.

0 days on Free, 1 day on Foundation, up to 7 days on Scale and Enterprise with a default of 3 when a domain is created. Read that as a replay buffer for a failed webhook handler, not a memory layer for an agent. AgentMail persists message history on every plan.

Not natively. Mailgun forwards the raw MIME through your route action; threading is code you write against Message-Id, In-Reply-To, and References headers, and a database you maintain. If a webhook delivery fails before your database write completes, the References chain breaks and Gmail or Outlook starts a new thread. AgentMail threads automatically through the reply API, which takes a message_id and handles the headers.

For agent inbox workloads, AgentMail's free tier is the strongest fit: 3 real inboxes, 3,000 emails per month, persistent retention, and native inbound via webhook or WebSocket. Mailgun's free tier includes routes and inbound at 100/day (~3,000/month) but retains no MIME storage (0 days), so any message body has to be persisted from the webhook payload during the request window or lost. If your agent needs to reference inbound messages beyond the immediate webhook, persistent retention is the deciding factor.

Mailgun's route-plus-webhook system is the deepest in the category for pattern-matched inbound routing on a single domain. AgentMail's per-inbox webhooks and WebSocket streams are the deepest for per-identity event routing and persistent state. Both fire on message.received; the difference is that Mailgun's webhook is scoped to a route (many local parts, one handler by default) while AgentMail's is scoped to an inbox (one address, one handler, or one pod, or one org, depending on how you configure scoped webhooks).

AgentMail. client.inboxes.create() returns a working inbox with a real address, client.inboxes.messages.send() sends from it, and client.inboxes.messages.list() reads inbound. Persistent storage, thread grouping, and reply-in-thread come with the inbox rather than as your own code on top. Mailgun exposes REST for send and route management; the receive side is a webhook-plus-storage system your application assembles.

Yes. Subaccounts segment sending programs, IP pools, and reporting for larger fleets. They isolate reputation by tenant when configured well. What subaccounts do not give you is a per-agent inbox object with scoped credentials and per-inbox event routing. AgentMail's Pods group per-tenant inboxes with scoped API keys and scoped webhooks in one primitive.

No. Mailgun exposes an HTTP API and an MCP server; both work with any framework, but neither ships a first-party connector package for the agent orchestration frameworks. AgentMail ships tested first-party connectors for LangChain, LlamaIndex, CrewAI, and LiveKit, and is an official OpenClaw plugin on ClawHub.

Yes. AgentMail ships as an official plugin on ClawHub, with a CLI-backed AgentMail Skill and an email channel where inbound mail drives an agent turn and the agent replies in the thread. Install with one command. Mailgun is not an official plugin for any agent orchestrator.

Agent-initiated signup means an AI agent can provision its own email capability without a human completing the signup flow first. AgentMail supports this via x402, an open payment protocol from Coinbase that lets agents pay for services autonomously as part of a workflow. Mailgun and every other transactional email API in the category require a human to complete signup before an API key exists.

Agent Armor is AgentMail's inbound screening layer for agent inboxes. It screens after receipt, never in front of your MX record. Rules catch hidden signals and a model reads the whole message for intent, so mail that would steer an agent is held for review rather than passed through. It sits on top of per-inbox allowlists and blocklists, per-inbox scoped API keys, and Pod-level isolation, because any inbound message can carry untrusted content into an agent's context and the correct defense is a layered one: filter senders at ingest, scope credentials so blast radius is bounded, isolate tenants so a compromise in one Pod cannot reach another.

Yes. Semantic search runs across every inbox in your organization by meaning rather than keyword. Useful when an agent needs to recall a past communication or reason across many identities. Mailgun does not offer a semantic search surface.

Yes. AgentMail can pull structured data out of unstructured messages (invoices, receipts, verification codes, order confirmations) as part of the platform. Automatic labeling categorizes incoming mail with user-defined prompts at ingest, so downstream routing can dispatch on category. Mailgun does not offer either.

Yes. Outposts is AgentMail's BYOC option, available on Enterprise. Outposts runs the email side of AgentMail inside the customer's own AWS account, which is aimed at teams whose email infrastructure has to sit inside their own cloud boundary for compliance, contractual, or sovereignty reasons. EU region hosting and SAML are also Enterprise features. Mailgun does not offer a public BYOC or self-hosted deployment path.

Yes. Mailgun's email validation API works independently of its send infrastructure. You can call it before an AgentMail send to filter recipients, and process the results in your own application logic. AgentMail focuses on the inbox side of the problem; pre-send validation is orthogonal.

Yes. Some teams use Mailgun for high-volume one-way outbound notifications, marketing broadcasts, or complex regex-based inbound routing, and AgentMail for agents that need full inbox capabilities. The two cover different parts of the email surface.

When the workload is send-heavy or send-only, deliverability tooling and route flexibility matter more than message history and agent-specific identity, replies only need to hit a single webhook endpoint, or you need Mailgun's specific strengths in regex-matched inbound routing, email validation, marketing template management, or per-region compliance.

Mailgun's pay-as-you-go Flex rate doubled from $1.00 to $2.00 per 1,000 emails on December 1, 2025. Developer communities including Ghost Forum and LowEndTalk documented significant backlash from low-volume users and side projects that were priced against the old rate. If your workload sits above the Free tier's 100/day cap and below the Foundation plan, the low-volume economics changed materially. Foundation, Scale, and Enterprise plan pricing was not affected.

Yes, SOC 2 Type II. Available on the Startup plan and above.

Yes. Per-inbox allowlists and blocklists filter senders before messages reach the agent. Combined with per-inbox API keys, this limits the blast radius of an injected message. On top of that, Agent Armor screens the inbound content that does reach the agent, holding suspicious mail for review when enforcement is enabled rather than bouncing it.

Mailgun (delivering since 2010) is a transactional and marketing email API with strong deliverability tooling, a routes-based inbound system, an email validation API, template management, and a 50-plus tool MCP server; the send side is the core product. Inbound is a routes-plus-webhook system with 0 to 7 days of MIME retention depending on plan, no inbox object, no thread model, and no per-address provisioning API. AgentMail is built around the inbox as the API object: one API call provisions an addressable inbox with a persistent store, automatic threading, per-inbox webhooks and WebSockets, per-inbox API keys, and multi-tenant Pods on every plan including Free. On top of that primitive, AgentMail ships framework connectors (LangChain, LlamaIndex, CrewAI, LiveKit), an official OpenClaw plugin, prompt-injection defense via Agent Armor, semantic search, structured data extraction, and BYOC deployment through Outposts.

Yes. The free tier includes 3 inboxes and 3,000 emails per month, no credit card required. AgentMail is the first email provider built for AI agents, and the free tier is enough to put a real agent inbox into production.

Blog

Suggested reading

View all posts

Prompt

Give yourself access to AgentMail by following the guide at:

https://docs.agentmail.to/agent-onboarding.md

and refer to:

https://docs.agentmail.to/llms.txt

for the documentation index.

Start integrating AgentMail into your AI agents today.