Incoming mail, already parsed.
Point your domain at Drin. Every message reaches your webhook as JSON, with the new part of the reply as clean text.
Raw email is mostly what was already said.
MIME, quoted history and signatures, around the one line you want. Drin takes it apart and posts you the rest.
From Maya Chen <maya@example.com>To support@acme.devCould you resend the invoice as a PDF?Thanks, Maya-- Maya Chen, FinancesignatureSent from my iPhonemobile footerOn Wed, Acme wrote:quoted history> Thanks for your order.What stays is what she just wrote.Clean textThreadSPF, DKIM, DMARCInjection score"text": "Could you resend the invoice…""threadId": "7f3c…""authResults": { "dmarc": "pass", … }"flags": { "injectionSuspected": false }
POST acme.dev/hooks/drin
Signed, and retried for 24 hours.GET /v1/inbound/drops
Mail refused or dropped, and why, for 14 days.From maya@example.comCould you resend the invoice as a PDF?Thanks, Maya-- Maya Chen, FinanceSent from my iPhoneOn Wed, Acme wrote:> Thanks for your order.What stays is what she just wrote.Clean textThreadSPF, DKIM, DMARCInjection score"text": "Could you resend…""threadId": "7f3c…""authResults": { "dmarc": "pass", … }"flags": { "injectionSuspected": false }
POST acme.dev/hooks/drin
Signed, and retried for 24 hours.GET /v1/inbound/drops
Mail refused or dropped, and why.Clean text
Quoted history, signatures and mobile footers are cut, up to 32 KB.truncatedsays when it was cut short. Hidden text comes out too and the original is kept, though that can't catch every trick.Sender checks and threads
SPF, DKIM and DMARC results come with each message,verifiedsays whether the sender was, and a reply is threaded with the one it answers.Checked before your agent reads it
With Drin Airlock on for a key, each email gets a risk level,low,mediumorhigh. Risky mail still lands, with a warning your agent reads first. No check catches every attack.
A handler in twenty lines.
Four calls to set it up. No public URL? Read the same events from the stream or a long poll.
# Turn on receiving. The reply has the one MX record to publish.
PATCH /v1/domains/:id/receiving
# Pick the addresses, or set catchAllInboxId for everything else.
POST /v1/inboxes
# Subscribe. The signing secret is shown once.
POST /v1/webhooks
{ "url": "https://acme.dev/hooks/drin", "eventTypes": ["inbound_received"] }
# Test the real path, marked testMode, before any real mail.
POST /v1/inbound/simulateimport { verifyWebhook } from "@drin00/sdk";
export async function POST(req: Request) {
const raw = await req.text();
const { type, data } = verifyWebhook(
raw,
req.headers.get("drin-signature") ?? "",
process.env.DRIN_WEBHOOK_SECRET!,
).payload;
if (type === "inbound_received") {
await tickets.add({
from: data.from,
thread: data.threadId,
text: data.text,
review: data.flags?.injectionSuspected === true,
});
}
return new Response("ok");
}{
"type": "inbound_received",
"data": {
"messageId": "…", "threadId": "…",
"inbox": { "id": "…", "address": "support@acme.dev" },
"from": "maya@example.com", "fromName": "Maya Chen",
"subject": "Re: Your receipt for order 1042",
"text": "Could you resend the invoice as a PDF?\n\nThanks,\nMaya",
"truncated": false,
"source": "external_email", "verified": true,
"testMode": false, "hiddenContentRemoved": false,
"flags": { "injectionSuspected": false, "injectionReasons": [],
"hiddenContentRemoved": false, "partsDiffer": false },
"authResults": { "spf": "pass", "dkim": "pass", "dmarc": "pass" }
}
}