Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 3 min read

What actually happens when you run a shared email domain for AI agents

Giving an AI agent an email address looks simple on paper. Spin up an SMTP relay, hook up an inbound webhook, hand the agent an API key, done. In practice, the plumbing takes an afternoon. Keeping the domain from gettin

Giving an AI agent an email address looks simple on paper. Spin up an SMTP relay, hook up an inbound webhook, hand the agent an API key, done.

In practice, the plumbing takes an afternoon. Keeping the domain from getting blacklisted takes most of the real engineering.

Most builders hit the same three bad options first:

  • Give the agent your personal Gmail. Now a prompt injection or a stray tool call has access to your password resets, billing, and identity.
  • Buy a fresh domain per agent. Now you are managing DNS, SPF, DKIM, and cold-start warmup every time you spin up a new worker.
  • Use a disposable burner service. Almost every service that matters (GitHub, Linear, Slack, Stripe) already blocklists burner domains, so OTPs never arrive.

A shared domain with managed reputation solves this for developers, because one API call gives an agent a working address with zero DNS setup. The catch is that the moment your shared domain has decent deliverability, spammers and burner-account farmers show up immediately.

The two abuse vectors that show up fast

Running AgentMail (our MIT open-source agent email service on @theagentmail.net) surfaced two distinct abuse patterns right away:

  1. Outbound phishing and unsolicited cold blasts. Someone creates a free trial account, names the org something generic, and immediately tries to blast cold outreach or phishing templates impersonating Meta or SaaS login alerts. If even a handful of those leave the server, spam complaints tank inbox placement for every legitimate agent on the domain.
  2. Free burner OTP farming. Automated scripts sign up for free trials just to receive signup and verification codes for other platforms, burning through addresses with zero intention of paying.

What actually stops it without breaking legit agents

Rate limits alone do not work, because ten phishing emails are enough to hurt domain reputation. Static keyword lists help for obvious templates, but spammers rephrase constantly.

The setup that has worked well in production layers four checks:

  1. Phone verification on free trials so spinning up 50 throwaway orgs is not free.
  2. Blocking inbound signup, OTP, and account-activation emails on free trials. Free trials still get full normal send/receive and webhooks so developers can test their integration, while OTP/signup verification emails unlock as soon as an org adds a $5 prepaid deposit (which covers 5 mailbox-months at $1/mo and never expires).
  3. A real-time AI outbound spam and phishing classifier that inspects every outbound email before it leaves the server. Legitimate 1:1 agent correspondence, deploy alerts, and human handoffs pass right through; phishing, credential harvesting, and unsolicited mass spam get rejected synchronously with 400 SPAM_REJECTED.
  4. Cross-isolate locks and rate limits in Cloudflare Durable Objects so concurrent requests cannot race trial creation or replay webhooks.

Making it zero-friction for coding agents (Remote MCP + llms.txt)

The other lesson from watching developers integrate email into Claude Code, OpenCode, Cursor, and OpenClaw is that nobody wants to install another wrapper SDK or run a local stdio bridge just to check an inbox.

We just shipped a native Streamable HTTP remote MCP endpoint directly inside the Cloudflare Worker at https://api.theagentmail.net/mcp. You can wire it into Claude Code with one command:

claude mcp add --transport http agentmail https://api.theagentmail.net/mcp \
  --header "Authorization: Bearer am_..."

Tokens are strictly scoped. An account-scoped key only exposes tools for that single mailbox (get_mailbox, list_messages, get_message, send_email, get_attachment_url, and webhook management) and cannot list other mailboxes or touch org billing. If you prefer plain HTTP, pointing any coding agent at https://theagentmail.net/llms.txt gives it the entire REST and MCP spec in one fetch.

The whole stack (Cloudflare Workers, Durable Object guards, Resend, InstantDB, spam classifier, and Preact UI) is MIT open source on GitHub if you want to read the code or self-host it on your own domain: github.com/uriva/agentmail.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.