Inbound email parsing.
When someone replies to your agent, you get a structured event. Not raw email. Not MIME blobs. The injection score and sender reputation are always there. It's two lines to start listening.
Every inbound to your agent address arrives as a structured event — injection_score + sender_reputation always included; intent, entities, and urgency when you enable classification (opt-in). SES inbound → Lambda → structured reply event. Webhook delivery (HMAC-signed) or SDK reactor.
Architecture in 4 boxes.
MX → worker → structured event
Every inbound MX-routes to our mail infrastructure and fires a worker that parses the message, scores it for prompt injection, resolves the agent it was addressed to, and writes one structured event. Your app reads the event or receives the webhook — it never parses MIME.
Multipart attachments handled
PDFs / images / docs come through as attachment metadata. Atlas use case (document parser) gets attachment.parsed events with extracted fields.
Webhook OR SDK reactor
Same event delivered via HTTPS webhook (HMAC-signed, retried with exponential backoff + DLQ) or via SDK reactor (long-poll). Same payload, different transports.
Thread reconstruction
Replies are linked to the parent send via In-Reply-To headers. event.thread_id ties an entire conversation together.
Register a webhook (or use the reactor).
// 1. Register an inbound webhook (one-time)
await mails.webhooks.create({
url: "https://your-app.com/api/inbound",
events: ["reply.received"]
});
// 2. Or listen via the SDK reactor (no webhook needed)
const agent = mails.agent("sarah"); // sarah@yourcompany.mails.ai
agent.onReply((event) => {
// event.injection_score + sender_reputation + body
// (+ intent + entities with opt-in classification)
});Built for agents.
Self-serve in minutes.
The API is live and self-serve. Drop ~6 lines into your agent and ship.
$ npm install @mailsai/sdk