Connect AI email agents to your CI/CD system, alerting stack, and incident workflows. Programmable, observable, and resilient — without sacrificing operational control.
Generic mail APIs were designed for transactional messages, not operational workflows. They lack observable send queues, have no concept of agent-safe permissions, and give DevOps teams no way to distinguish a human-composed email from one generated by an automated agent. When a deployment fails at 2am and your incident response pipeline needs to notify stakeholders, route escalations, and log everything to your audit trail, you need infrastructure that behaves like infrastructure — not a marketing email service bolted onto a REST endpoint.
MultiMail provides a REST API and MCP server purpose-built for agents operating in production pipelines. Every send goes through an observable queue you can inspect and cancel. Every action produces a structured audit event. The monitored oversight mode is a natural fit for DevOps: agents send autonomously, but every delivery is visible to your team in real time. You can hook MultiMail into a Cloudflare Worker, a GitHub Actions step, or an existing alerting stack without changing your queue or on-call tooling.
A deployment completion, failed health check, or PagerDuty escalation fires a webhook or queue message. Your agent receives the event payload — build SHA, environment, affected services, timing data — and begins composing context.
The agent calls your monitoring APIs to gather incident links, rollout timing, and health check results, then drafts a structured summary. No template required — the agent produces the message body from live data.
For routine deploy summaries, the agent calls send_email directly under monitored mode and the message goes out immediately. For high-severity incidents, you configure gated_send so a human approves before delivery to stakeholders outside your org.
Every send produces a delivery event you can consume via webhook or poll with check_inbox. list_pending shows any messages still in queue. cancel_message lets you pull a queued send before delivery if the incident resolves.
MultiMail logs every agent action — who sent, what oversight mode was active, delivery status, and any approval events — giving you a complete record for postmortems and compliance reviews.
import httpx
import os
MM_API_KEY = os.environ["MM_API_KEY"]
def send_deploy_notification(env: str, sha: str, duration_s: int, health_checks: list[dict]):
checks_text = "\n".join(
f" - {c[&"cm">#039;name']}: {'PASS' if c['ok'] else 'FAIL'}" for c in health_checks
)
body = f"""Deployment to {env} completed.
Commit: {sha}
Duration: {duration_s}s
Health checks:
{checks_text}
View run: https://github.com/your-org/your-repo/commit/{sha}
"""
resp = httpx.post(
"https://api.multimail.dev/v1/send_email",
headers={"Authorization": f"Bearer {MM_API_KEY}"},
json={
"from": "[email protected]",
"to": ["[email protected]"],
"subject": f"Deployment completed for {env}",
"body": body,
"oversight_mode": "monitored",
"tags": ["deploy", env, sha[:8]],
},
)
resp.raise_for_status()
return resp.json()["message_id"]
Send a deployment summary email from a GitHub Actions or generic CI pipeline step using the REST API.
import httpx
import os
MM_API_KEY = os.environ["MM_API_KEY"]
def escalate_incident(incident_id: str, severity: str, affected: list[str], summary: str):
recipients = {
"P0": ["[email protected]", "[email protected]"],
"P1": ["[email protected]"],
}
mode = "gated_send" if severity == "P0" else "monitored"
body = f"""Incident {incident_id} — {severity}
Affected services: {&"cm">#039;, '.join(affected)}
{summary}
This message was drafted by the incident-response agent and requires approval before delivery.
"""
resp = httpx.post(
"https://api.multimail.dev/v1/send_email",
headers={"Authorization": f"Bearer {MM_API_KEY}"},
json={
"from": "[email protected]",
"to": recipients.get(severity, ["[email protected]"]),
"subject": f"[{severity}] Incident {incident_id}: {affected[0] if affected else &"cm">#039;unknown service'}",
"body": body,
"oversight_mode": mode,
"tags": ["incident", severity.lower(), incident_id],
},
)
resp.raise_for_status()
data = resp.json()
return data["message_id"], data.get("pending_approval", False)
For P0 incidents, route stakeholder notifications through gated_send so an on-call engineer approves before external delivery.
import httpx
import os
MM_API_KEY = os.environ["MM_API_KEY"]
BASE = "https://api.multimail.dev/v1"
HEADERS = {"Authorization": f"Bearer {MM_API_KEY}"}
def get_pending_for_incident(incident_id: str) -> list[dict]:
resp = httpx.get(
f"{BASE}/list_pending",
headers=HEADERS,
params={"tag": incident_id},
)
resp.raise_for_status()
return resp.json()["messages"]
def cancel_if_resolved(incident_id: str, resolved: bool) -> int:
if not resolved:
return 0
pending = get_pending_for_incident(incident_id)
cancelled = 0
for msg in pending:
r = httpx.post(
f"{BASE}/cancel_message",
headers=HEADERS,
json={"message_id": msg["message_id"]},
)
if r.status_code == 200:
cancelled += 1
return cancelled
Check what messages are queued and cancel a pending notification if the triggering incident resolves before delivery.
import { Hono } from 'hono';
const app = new Hono<{ Bindings: { MM_API_KEY: string; PAGERDUTY_KEY: string } }>();
app.post('/webhooks/multimail/inbound', async (c) => {
const sig = c.req.header('x-multimail-signature');
"cm">// verify HMAC signature from webhook secret here
const event = await c.req.json();
if (event.type !== 'email.received') return c.json({ ok: true });
const { from, subject, body_text, mailbox } = event.data;
"cm">// Route alert emails from monitoring systems to PagerDuty
if (mailbox === '[email protected]' && subject.toLowerCase().includes('critical')) {
await fetch('https://events.pagerduty.com/v2/enqueue', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
routing_key: c.env.PAGERDUTY_KEY,
event_action: 'trigger',
payload: {
summary: subject,
source: from,
severity: 'critical',
custom_details: { body: body_text },
},
}),
});
}
return c.json({ ok: true });
});
export default app;
Receive inbound emails to a monitored mailbox and route them into your alerting pipeline from a Workers edge function.
Every outbound message enters a queue you can inspect with list_pending and cancel with cancel_message. If an incident resolves before your notification sends, you can pull the message. Generic SMTP relays offer no equivalent.
Configure monitored mode for routine deploy summaries and gated_send for P0 escalations — in the same pipeline, using the same API. No separate tool for 'high-trust' vs 'low-trust' sends.
Every agent action produces a timestamped audit event: who sent, which oversight mode was active, whether approval was required, and delivery status. Feeds directly into postmortems and SOC 2 evidence collection.
MultiMail's API runs on Cloudflare's global network. If you deploy your incident-response logic in Cloudflare Workers, your email calls stay on-network with sub-5ms routing latency in most regions.
Receive alert emails from external monitoring systems into a dedicated MultiMail mailbox and route them into PagerDuty, Slack, or your own queue via webhook. check_inbox and read_email let agents poll and triage inbound ops mail programmatically.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 50-tool MCP server. Formally verified in Lean 4.