AI agents read incoming emails, apply structured tags, and route them to the right handler — before urgent requests get buried in a general queue.
At high inbound volume, manual classification stops working. Support queues mix billing complaints with outage reports. Sales inboxes conflate renewals with churn signals. Urgent requests sit for hours because no one triaged them. The problem isn't that your team is slow — it's that classification is a repetitive, high-frequency task that humans aren't built to do at scale. A single missed priority email can cost more than the entire classification system.
MultiMail's inbound processing pipeline delivers each arriving email to your agent via webhook before it enters any human queue. The agent calls check_inbox or receives the push event, reads the full content with read_email, runs its classification logic, and writes structured tags back with tag_email. Downstream systems — ticket routers, Slack integrations, on-call pagers — subscribe to those tags via webhook and act immediately. The agent never sends email in this flow, so no approval gates slow it down. Classification latency is bounded by your inference time, not by human availability.
MultiMail delivers a POST to your configured webhook endpoint the moment an email arrives at your mailbox. The payload includes the email ID, sender, subject, and a preview. Your agent service handles this event rather than polling.
Your agent calls read_email with the email ID from the webhook payload to retrieve the full body, headers, and any attachments. This gives the classifier access to the complete signal — not just the subject line.
Pass the email content to your classification model or LLM. Extract structured fields: intent (support, sales, billing, abuse), urgency (critical, high, normal, low), sentiment (negative, neutral, positive), and topic tags. This step is entirely within your agent — MultiMail places no constraints on how you classify.
Call tag_email with the email ID and your classification results as structured tags. Tags are queryable and filterable across the MultiMail API, making them the source of truth for downstream routing decisions.
Webhook listeners subscribed to tag events receive the classification immediately. Route critical outages to PagerDuty, billing disputes to your finance queue, and positive responses to your CRM — all without human intervention in the classification step.
import express from 'express';
import { classifyAndTag } from './classifier';
const app = express();
app.use(express.json());
app.post('/webhooks/multimail', async (req, res) => {
const { event, email_id, mailbox } = req.body;
if (event !== 'email.received') {
return res.sendStatus(200);
}
"cm">// Acknowledge immediately; classify async
res.sendStatus(200);
await classifyAndTag(email_id);
});
app.listen(3000);Express handler that receives the MultiMail inbound webhook and dispatches to the classifier agent.
import Anthropic from '@anthropic-ai/sdk';
const MM_API = 'https://api.multimail.dev';
const MM_TOKEN = process.env.MM_API_KEY!;
const anthropic = new Anthropic();
export async function classifyAndTag(emailId: string): Promise<void> {
"cm">// 1. Read full email
const emailRes = await fetch(`${MM_API}/v1/emails/${emailId}`, {
headers: { Authorization: `Bearer ${MM_TOKEN}` },
});
const email = await emailRes.json();
"cm">// 2. Classify
const message = await anthropic.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 256,
system: 'You are an email classifier. Return JSON with fields: intent (support|sales|billing|abuse|other), urgency (critical|high|normal|low), sentiment (negative|neutral|positive), topics (string[]).',
messages: [{
role: 'user',
content: `Subject: ${email.subject}\n\n${email.body_text?.slice(0, 2000)}`,
}],
});
const classification = JSON.parse(message.content[0].text);
"cm">// 3. Write tags
await fetch(`${MM_API}/v1/emails/${emailId}/tags`, {
method: 'POST',
headers: {
Authorization: `Bearer ${MM_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
tags: [
`intent:${classification.intent}`,
`urgency:${classification.urgency}`,
`sentiment:${classification.sentiment}`,
...classification.topics.map((t: string) => `topic:${t}`),
],
}),
});
console.log(`Classified ${emailId}: ${JSON.stringify(classification)}`);
}Fetches full email content, runs LLM classification, and writes structured tags back via the MultiMail API.
import os
import json
import anthropic
from multimail_sdk import MultimailClient
mm = MultimailClient(api_key=os.environ["MM_API_KEY"])
ai = anthropic.Anthropic()
def classify_and_tag(email_id: str) -> dict:
"cm"># Read full email
email = mm.emails.get(email_id)
"cm"># Classify
response = ai.messages.create(
model="claude-sonnet-4-6",
max_tokens=256,
system=(
"You are an email classifier. Return JSON with: "
"intent (support|sales|billing|abuse|other), "
"urgency (critical|high|normal|low), "
"sentiment (negative|neutral|positive), "
"topics (list of strings)."
),
messages=[{
"role": "user",
"content": f"Subject: {email.subject}\n\n{(email.body_text or &"cm">#039;')[:2000]}",
}],
)
classification = json.loads(response.content[0].text)
# Apply tags
tags = [
f"intent:{classification[&"cm">#039;intent']}",
f"urgency:{classification[&"cm">#039;urgency']}",
f"sentiment:{classification[&"cm">#039;sentiment']}",
*[f"topic:{t}" for t in classification.get("topics", [])],
]
mm.emails.tag(email_id, tags=tags)
return classificationSame flow using the multimail-sdk Python package. Suitable for agent frameworks that run in Python.
const res = await fetch(
'https:"cm">//api.multimail.dev/v1/emails?tag=urgency%3Acritical&since=24h',
{
headers: { Authorization: `Bearer ${process.env.MM_API_KEY}` },
}
);
const { emails } = await res.json();
for (const email of emails) {
console.log(`[CRITICAL] ${email.subject} — from ${email.from} at ${email.received_at}`);
}Retrieve all critical-urgency emails from the last 24 hours for a dashboard or escalation sweep.
// In your MCP-connected client (Claude Desktop, Cursor, Windsurf):
// Step 1 — read the email
tool: read_email
params: { email_id: "em_01J8KXQZ4N2P3R5T7V9W" }
// Step 2 — after reviewing content, apply classification tags
tool: tag_email
params: {
email_id: "em_01J8KXQZ4N2P3R5T7V9W",
tags: ["intent:support", "urgency:critical", "sentiment:negative", "topic:database-outage"]
}
// Step 3 — check inbox for other critical items
tool: check_inbox
params: { tag: "urgency:critical", limit: 20 }If you're operating through an MCP client, use the tag_email tool directly after reading the email. No code deployment required.
Classification runs the moment email arrives, not when a human opens the inbox. Critical issues get tagged within seconds of delivery regardless of time zone or staffing level.
An LLM classifier applies the same intent and urgency taxonomy to the ten-thousandth email as it does to the first. Human classifiers drift over time; agents don't.
MultiMail tags are queryable via API and filterable in webhook subscriptions. Every downstream system — ticketing, alerting, CRM — can subscribe to exactly the classification signals it needs without coupling to your agent's internal logic.
Classification is a read-and-tag operation. The monitored oversight mode lets the agent act immediately without waiting for human approval, while still giving your team full visibility into every classification decision via the audit log.
Email volume spikes — product launches, outages, billing cycles — hit classification agents the same as steady state. Queue depth is the only constraint, not human bandwidth.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 50-tool MCP server. Formally verified in Lean 4.