All solutions

Solutions

Inbound Email API for AI Agents

An inbound email API for AI agents turns receiving mail into an event stream: each message to your agent's address is parsed into clean JSON — sender, subject, text body, thread id — scanned for prompt injection, and delivered to your webhook. Your agent handles a POST request, not a mailbox.

Receiving is an event, not a mailbox

IMAP polling, OAuth refresh, MIME multiparts — none of it belongs in an agent loop. Give the agent an address, register a webhook, and inbound mail becomes the same shape as every other event your code consumes:

curl "https://api.mails.ai/v1/events?event_type=message.received&limit=50" \
  -H "Authorization: Bearer $MAILS_API_KEY"

Each event carries the parsed message: who sent it, the subject, the clean text body, and the thread it belongs to — so replies land in context and your agent never reconstructs a conversation from raw headers.

Safe by default, priced per message

Inbound costs $0.002 per message including parsing and prompt-injection scanning; an optional intent/entity classification step is $0.003 more when you want routing decided before the LLM runs. Send replies from the same agent at $0.001 each — self-serve, no monthly fee.

Frequently asked questions

Do I need to parse MIME or strip HTML myself?

No. Parsing is the product: you receive the clean plain-text body alongside the structured metadata, which is exactly what you want to hand an LLM. Raw content stays available when you need it.

What about prompt injection hidden in incoming email?

Every inbound message is scanned before delivery and flagged in the payload, so untrusted instructions inside a message can be handled by policy instead of read blindly by your agent.

Webhook only, or can I poll?

Both, plus streaming: register a webhook for push, poll GET /v1/events with filters, or hold open the SSE stream at /v1/events/stream — whichever fits your runtime.

Live now

Built for agents.
Self-serve in minutes.

The API is live and self-serve. Drop ~6 lines into your agent and ship.

npmpnpmbunnpx
$ npm install @mailsai/sdk
Live on npm today · @mailsai/sdk + @mailsai/mcp-server