Back to Blog

How to give your AI agent its own email address

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.

More posts

SUSPENDED
gmail
Analysis

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, 2026
Analysis

Resend Alternative for AI Agents

Resend handles outbound well. When the agent needs to receive and reply in thread, there's no inbox — the developer builds it. Here's how Resend and OpenMail compare on inbound architecture, threading, retention, pricing, and code.

June 29, 2026
Analysis

OpenMail vs Nylas

Nylas connects to your users' existing inboxes. If your AI agent needs its own address, here's how Nylas Agent Accounts and OpenMail compare on limits, pricing, and code.

June 29, 2026
Shared infrastructure: three agents with dedicated IPs, rate-limited pools, and circuit breakers
Analysis

What Email Infrastructure for AI Agents Should Look Like

If you had to design email from scratch for AI agents, you wouldn't build Gmail. Here's what purpose-built infrastructure looks like — inbox-as-API, real-time delivery, threading, MIME parsing and IP warming/routing.

June 5, 2026
01Postmarksend-only
02Resendsend-only
03OpenMailagent-native
04AgentMailagent-native
05Mailgunbuild it
06Amazon SESbuild it
Analysis

Best email providers for AI agents in 2026

Most rankings put a transactional API at the top. If your agent needs to receive a reply, correlate a thread, or handle an OTP in under five seconds, the top two picks will cost you a refactor.

May 14, 2026
Analysis

OpenMail vs Mailgun vs Amazon SES

Mailgun sends. SES is cheap. Neither was built for agents that receive, thread, and parse attachments. Here’s what’s actually different between all three.

May 6, 2026
ASCII art render of the Creation of Adam — two hands reaching toward each other, one human, one digital
Analysis

Why Every Email Option Falls Short for AI Agents

Gmail bans agents. Proton has no API. Outlook is a maze. Resend can't receive. A look at why every email option falls short for AI agents and what the risks are.

Apr 13, 2026
OpenClaw email setup guide
Developer

How to Give OpenClaw Its Own Email Address

One ClawHub command gives your OpenClaw agent a dedicated inbox with real-time delivery. Choose a usage mode — tool, notify, or channel — and you're done.

Mar 29, 2026
eu
News

We're EU-Based. That's Not a Footnote — It's the Point.

OpenMail is built in the EU, runs in the EU, and every customer is covered by GDPR — not as a checkbox, but as a legal guarantee.

Mar 16, 2026
audience
Founder insights

This Is Not for Human Eyes

We noticed that AI agents were finding OpenMail before we'd fully built for them. Here's what we saw — and what we built next.

Mar 12, 2026