Building an agent startup? Apply now →
Back to Blog

How to give your AI agent its own email address

March 12, 2026 · Updated September 22, 2026

AI AgentsEmail InfrastructureGuide+1

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 / Google WorkspacePrototypes only
SendYes, 500/day (2,000 on Workspace)
ReceivePolling, quota units
ThreadingManual
IdentityOne account per agent, USD 7+/mo each
RiskHigh — automated patterns trip abuse detection
Transactional API (Resend, Postmark, Mailgun, SES)Send-only agents
SendExcellent
ReceivePartial — domain-level webhook, body often missing, short retention
ThreadingManual — you manage Message-ID / References and store state
IdentityNo inbox object; shared sending domain
RiskLow for sending, but the account is shared
Self-hosted (Postfix, DKIM, SPF, parsing pipeline)Teams with a mail engineer
SendYes
ReceiveYes, if you build it
ThreadingYes, if you build it
IdentityYes
RiskYour IP reputation is your problem
Agent email API (OpenMail, AgentMail, Mailtrap, Nylas)Built for this
SendYes
ReceiveWebhook or WebSocket with body and attachments
ThreadingAutomatic
IdentityOne inbox per agent, created by API
RiskDepends on the provider’s isolation model

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 AgentDocs →
hermes plugins install openmail --enable
hermes openmail setup
hermes gateway restart
OpenClawDocs →
openclaw plugins install clawhub:@openmail/openclaw
openclaw channels add --channel openmail --api-key <key>
openclaw gateway restart
Claude Code / Cursor / CodexDocs →
npm install -g @openmail/cli
openmail init
npx skills add openmailsh/skills
Any shell-based agentDocs →
npm install -g @openmail/cli
openmail init

Under 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.

create-inbox.js
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 this

Add 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.

scoped-key.js
// 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 key

3. 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.

webhook payload
// 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.js
// 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.

Every AI agent deserves its own inbox.

Install the CLI, run setup, and you're sending email from your agent in minutes.

From the blog

Latest posts

All posts →
Analysis8 min read

Email for AI agent platforms: what 1,000 inboxes really cost

Twelve ways to run 1,000 agent inboxes, from a few dollars to $14,000 a month, and what each leaves you to build.

Nov 5, 2026Read →
Developer5 min read

Inbound email with attachment text, ready for an LLM

An inbound email API that puts the text of PDFs, scans, Office files and CSVs into the webhook, ready for a model. What gets extracted, the limits, and the code to pass it to an LLM.

Nov 2, 2026Read →
News4 min read

OpenMail is in the ChatGPT plugin directory

ChatGPT could draft the email but never receive the reply. Now it can: OpenMail is in the ChatGPT plugin directory. Install, sign in once, and ChatGPT has an inbox of its own. Free plan included.

Oct 30, 2026Read →
Developer6 min read

How an AI agent receives email and replies to it

How inbound email reaches an AI agent over a webhook or WebSocket, what the event contains, and how the agent replies in the same thread. Working code included.

Oct 14, 2026Read →
SUSPENDED
gmail
Analysis12 min read

The Gmail suspension wasn't the problem. The architecture was.

Gmail suspensions for AI agents aren't random. The automation patterns that cause them look identical to spam. Here's what you've actually lost, why recovery rarely works, and how to move to something built for agents.

July 2, 2026Read →