Most developers try Gmail first. It works for a demo, then Google suspends the account for automated behaviour and the agent loses its address, its threads, and every service it signed up for. The next attempt is usually a transactional sender like Resend or Mailgun — good at delivery, but there's no inbox to receive into, no threading, and you end up building half an email server yourself.
The short answer: use an email API that was designed for agents. With OpenMail, one call creates an inbox like assistant@yourdomain.com, inbound mail arrives as a JSON webhook with the body and parsed attachments already in the payload, and the agent replies in the same thread with a second call. Each inbox has its own sending reputation, so one misbehaving agent can't damage the others. Data stays in the EU. The free plan covers three inboxes and 3,000 emails a month.
This guide walks through the four approaches, why three of them break at scale, and the exact calls to get an agent inbox running.
Why an agent needs its own address
Email is still the one channel every person, business and service accepts. An agent with an address can sign up for services and catch the verification code, send a follow-up and read the reply, pull invoices from vendors and parse the PDF, or answer support tickets in the customer's own mail client. Without one, a human has to copy-paste everything in and out.
The address also carries identity. billing@yourcompany.com gets treated differently from a random Gmail. When each agent has its own inbox you can see exactly what it sent and received, and shut it down without touching the rest of your fleet.
The four ways to do it
Gmail is the one most developers reach for first. In February 2026 Google permanently suspended accounts that had connected OpenClaw through OAuth — no warning, no refund. New accounts created specifically for agents get flagged even faster. We wrote up the details in why every email option falls short and what to do when Gmail suspends your agent.
Transactional senders fail more quietly. Resend, Postmark and Mailgun are excellent at delivery, and some can receive inbound mail. But there's no inbox object: inbound is a catch-all on the domain, threading is headers you manage yourself, and retention is 30 days on Resend's free and Pro plans. For an agent that needs to hold a conversation over weeks you end up building the inbox from scratch on top of the sender.
The fastest path depends on your framework
If you're already on Hermes, OpenClaw, or Claude Code, you don't need to touch the REST API directly — each has a plugin or skill that handles inbox creation, receiving, and replying under the hood. Pick your framework:
hermes plugins install openmail --enable
hermes openmail setup
hermes gateway restartopenclaw plugins install clawhub:@openmail/openclaw
openclaw channels add --channel openmail --api-key <key>
openclaw gateway restartnpm install -g @openmail/cli
openmail init
npx skills add openmailsh/skillsnpm install -g @openmail/cli
openmail initUnder the hood: the REST API in four calls
Every integration above is a wrapper around these four API calls. If you're building your own agent loop, using LangChain or the Vercel AI SDK, or just want to understand what's happening, here's the full sequence.
1. Create the inbox.
const res = await fetch("https://api.openmail.sh/v1/inboxes", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPENMAIL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
mailboxName: "assistant",
displayName: "Acme Assistant",
webhookUrl: "https://yourapp.example/webhooks/openmail",
}),
});
const inbox = await res.json();
// inbox.address → "assistant@openmail.sh"
// inbox.webhookSecret → verify inbound signatures with thisAdd domain: "yourdomain.com" once the domain is verified (Pro plan) and the address becomes assistant@yourdomain.com. SPF, DKIM and DMARC are configured for you.
2. Give the agent a key scoped to this inbox only, so a compromised agent can reach nothing else.
// Give the agent a key that can only reach its own inbox
const key = await fetch(
`https://api.openmail.sh/v1/inboxes/${inbox.id}/api-keys`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPENMAIL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "assistant-agent" }),
},
).then((r) => r.json());
// key.token → pass this to the agent, not your account key3. Receive.
When mail arrives, OpenMail POSTs a signed message.received event to your webhook. The body text and the parsed text of attachments are in the payload, so the agent can act without a second fetch.
// Verify X-Signature with HMAC-SHA256 over "{timestamp}.{payload}"
{
"event": "message.received",
"inbox_id": "inbox_123abc",
"thread_id": "thr_xyz",
"message": {
"from": "vendor@example.com",
"to": "assistant@yourdomain.com",
"subject": "Invoice 2847",
"body_text": "Please find the invoice attached.",
"attachments": [{
"filename": "invoice.pdf",
"parsedText": "Invoice #2847\\nAmount: $1,250.00",
"extractionMethod": "pdf"
}]
}
}If you would rather not run an endpoint, subscribe over WebSocket and get the same events.
4. Reply in the thread.
// Reply in the same thread — recipient sees a normal threaded reply
await fetch(`https://api.openmail.sh/v1/inboxes/${inbox.id}/send`, {
method: "POST",
headers: {
Authorization: `Bearer ${agentKey}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
to: event.message.from,
body: "Received, thank you. Payment is scheduled for 30 September.",
threadId: event.thread_id,
}),
});The recipient sees a normal reply in their mail client. GET /v1/inboxes/{id}/threads returns the whole conversation as JSON to load into the agent's context before it answers.
What to check before you pick a provider
The things that matter most aren't on the feature matrix. Can the agent actually receive mail, or just send it? When an inbound message arrives, is the body in the event or do you need a second fetch? Do replies thread automatically, or are you managing Message-ID and References headers and storing state in your own database?
Then look at isolation. On a shared sending domain with pooled reputation, one bad tenant degrades everyone. OpenMail isolates sending reputation per inbox and groups inboxes into pods for multi-tenant setups. Check where the data lives — OpenMail runs from Vilnius with EU data residency on every plan. And read the acceptable use policy and the termination clause before you put customers on any provider.
On price: OpenMail Pro is EUR 9 a month for 10 inboxes and 10,000 emails, then EUR 1 per additional inbox. AgentMail's Developer plan is USD 20 a month for 10 inboxes and 10,000 emails, then USD 2 per inbox.
Other providers worth looking at
OpenMail isn't the only option. AgentMail (San Francisco) has dedicated inboxes, automatic threading and WebSocket delivery, with a free plan of 3 inboxes and 3,000 emails. Mailtrap Agent Inbox gives agents hosted or custom-domain inboxes with JSON payloads and an MCP server; hosted inboxes are capped at 20 replies. Nylas Agent Accounts provision a domain address with mail and calendar through the existing Nylas API. We compared all of them in best email API for AI agents in 2026.
Frequently asked questions
What email should I give my AI agent?
A dedicated inbox on your own domain, with its own sending reputation. Not a shared Gmail (suspension risk, no structured receiving) and not a transactional sender alone (no inbox, you build threading yourself).
Can I just use Gmail?
For a demo, sure. In production, Gmail’s abuse detection treats automated patterns as spam. The API caps you at 500 sends a day, accounts created for agents get suspended without warning, and each one costs USD 7+ a month on Workspace.
How does an agent actually receive and reply?
The provider pushes each inbound message as a webhook or WebSocket event. With OpenMail the event includes the body, parsed attachments, and a thread ID. The agent replies to that thread ID and the recipient sees a normal threaded reply in their mail client.
Can each agent or tenant get its own address?
Yes. One API call per inbox. OpenMail’s pods group inboxes into isolated sub-accounts for multi-tenant products, each with its own keys and sending reputation.
What does it cost?
Free: 3 inboxes, 3,000 emails a month, no card. Pro: EUR 9 a month for 10 inboxes and 10,000 emails, then EUR 1 per inbox and EUR 0.001 per email beyond that.



