The email API built for agents.

Each agent gets its own address, its own reputation and replies scored for prompt injection.

Six lines

Drop in. Get typed replies back.

No SMTP to wire up and no raw MIME to parse. Each agent gets its own address, identity and reply inbox, and replies arrive as typed, scored events.

import { mails } from "@mailsai/sdk";

const hello = mails.agent("hello");

await hello.send({
  to: "user@example.com",
  subject: "Your password reset code",
  body: "Your code is 481920.",
});

hello.onReply((reply) => {
  if (reply.quarantined) return;
  // use reply.data.extracted_text
});

Dashboard

Watch every email your agents send

Each message shows its status from queued to delivered. Events stream in as they happen, with their scores, and each conversation reads as one thread.

The Messages page of the dashboard: each sent email with its recipient, status, subject and time

Sending

Every way to send, one call each

Schedule a send for later, send a hundred in one request, or attach the invoice. Each is one call, with the same fields as a single send.

import { createClient } from "@mailsai/sdk";

const mails = createClient();

await mails.send({
  from: "hello",
  to: "jordan@example.com",
  subject: "How did order #10473 arrive?",
  body: "Just reply to this email.",
  scheduled_at: "2026-10-12T09:00:00Z",
});

Idempotency keys on every send meant a dropped connection never emailed a customer twice. We stopped thinking about it.

Matteo BellandiFounding Engineer at Mallowbridge
API reference

Idempotency keys

Retry without sending twice. The same Idempotency-Key within 24 hours returns the first response, and a reused key with a new body is refused.

import { createClient } from "@mailsai/sdk";

const mails = createClient();

// Safe to retry: one email goes out.
await mails.send({
  from: "hello",
  to: "jordan@example.com",
  subject: "Your order #10473 has shipped",
  body: "Expect it in 2–3 days.",
  idempotency_key: "order-10473-shipped",
});

Trust

Know where you stand, before you ship

What is running, how your keys are kept, and where your questions go. How mail is routed is on the architecture page.

  • Status in the open

    The status page lists each part of the service, how it is watched, and how we handle an incident.

  • Keys kept safely

    API keys are stored only as SHA-256 hashes and shown once. Each key carries scopes, and every webhook is signed.

  • Support by email

    Questions about your integration go to support@mails.ai or through the contact page.

Guides

Go deeper: guides for agent builders

How the whole stack fits together is in the email for AI agents guide.

  • Best email API for AI agents 2026

    A full provider comparison: pricing, inbound parsing, MCP support and architecture.

  • Architecture and provider guide

    How a real agent email flow works, and what to look for in a provider.

  • Transactional email for agents

    Codes, sign-in links and notifications: the transactional side of agent email.

  • Inbound email for agents

    Receive, parse and classify inbound email with structured webhook events.

  • Send from a Python agent

    A Python SDK quickstart, with Flask and FastAPI examples.

  • Send from a Node.js agent

    A TypeScript SDK quickstart for an agent running on Node.js.

  • Email API for AI agents

    Six-line send-and-receive examples in TypeScript and Python, with FAQ.

Frequently asked questions

What is an email API for AI agents?
An email API for AI agents is infrastructure that lets autonomous software agents send, receive, and reply to email programmatically — without IMAP polling, MIME parsing, or OAuth credential management. Unlike transactional email APIs built for human-triggered sends, an agent-native email API provides bidirectional messaging, per-agent identity, structured reply events, and prompt-injection scanning so agents can hold real conversations safely.
How is Mails.ai different from a traditional email API like SendGrid or Resend?
SendGrid and Resend are built around sending. Both can receive mail too, but what arrives is the raw message: SendGrid’s Inbound Parse webhook posts the body and attachments for your code to parse, and Resend’s webhook carries metadata, with the body one more API call away. Mails.ai delivers every reply as a structured JSON event with an injection score and sender reputation, and with classification on, first-contact mail carries its intent too. Each agent gets its own address, reputation is tracked per agent, and cold outreach is blocked at the API to protect deliverability.
Which programming languages does the email API support?
Mails.ai offers first-party SDKs for TypeScript (npm @mailsai/sdk) and Python (pip mailsai), plus a REST API that works from any language. There is also an MCP server (npx @mailsai/mcp-server) for drop-in integration with Claude Code, Cursor, Cline, Continue, Windsurf, and other MCP-compatible agent frameworks.
Does the email API include prompt-injection protection?
Yes. Every inbound message within your plan’s limits is scanned for prompt-injection patterns across six categories — boundary manipulation, system prompt override, data exfiltration, role hijacking, tool invocation, and jailbreaks — before it reaches your agent code. The injection_score (0–1) arrives on the event payload so your agent can branch on a number rather than trusting the LLM to notice an attack embedded in the message.
What does an email API for AI agents cost?
The free tier covers 3,000 emails and 3,000 inbound replies per month with one agent — no credit card required. Pro is $20/month for 50,000 emails and 50,000 inbound replies across five agents. Scale is $99/month for 250,000 emails, 500,000 inbound replies, and unlimited agents. Yearly billing saves two months on both paid plans.
Can I use my own domain with the email API?
Yes — on any paid plan. Add your domain in the dashboard and Mails.ai returns the DKIM, SPF, and DMARC records to add at your registrar. Once verified, every agent on that domain sends as agent@yourcompany.com, DKIM-signed and fully authenticated.

Give your first agent an inbox

Free covers 3,000 emails and 3,000 inbound replies a month, with no card. Upgrade when your agents get busy.

Get your API key