React to Email Events in Real Time

MultiMail emits structured webhook payloads for every stage of the email lifecycle — sent, delivered, bounced, inbound reply, complaint — so your agent can act the moment something changes.


Why this matters

AI agents that send email are flying blind without a reliable event stream. A message can bounce silently, a reply can sit unread for hours, or a complaint can go undetected until deliverability craters. Polling the inbox is slow, noisy, and misses transient events like delivery confirmations and bounce codes entirely. Without a real-time signal, agents cannot trigger retry logic, route replies to the right workflow, or escalate failures before they compound.


How MultiMail solves this

MultiMail emits a webhook for every material email event: message.sent, message.delivered, message.bounced (soft and hard), message.received (inbound), and message.complained. Each payload is signed with an HMAC-SHA256 signature so your endpoint can verify authenticity before processing. Each delivery is wrapped as { event, timestamp, data }, and the data object carries the mailbox_id, the email_id, and event-specific fields (SMTP diagnostic codes on bounces) — enough for your agent to branch without a follow-up API call. You subscribe per mailbox (or account-wide), and MultiMail fans events out to your endpoint.

1

Register a webhook endpoint

POST to /v1/webhooks with your endpoint URL and the event types you care about (message.received, message.sent, message.delivered, message.bounced, message.complained; oversight.pending/approved/rejected are also available). Creation requires operator approval. MultiMail returns the subscription id and a signing secret you store securely.

2

Receive structured event payloads

When an event fires, MultiMail POSTs a JSON payload shaped as { event, timestamp, data }. The data object includes mailbox_id and email_id, plus event-specific fields (e.g., bounce_code, diagnostic, and recipient on bounce events; from and subject on inbound events).

3

Verify the signature

Each request carries an X-MultiMail-Signature header formatted as sha256=<hexdigest> — an HMAC-SHA256 of the raw request body using your signing secret. Recompute it (with the sha256= prefix) and reject any request where the signature does not match before executing downstream logic.

4

Route to the correct agent workflow

Branch on the payload's event field. A message.received event triggers read_email (using the data's email_id) to fetch the full message. A hard bounce triggers your suppression and retry logic. A complaint triggers immediate opt-out handling.

5

Update agent state

After processing, your agent calls set_tags or updates its own state store to mark the email as handled. This prevents duplicate processing if a retry delivers the same event.


Try it with your agent

Pick your platform, copy the prompt, and paste it to your AI agent — it sets up MultiMail and builds the whole flow. Nothing to fill in.

1. Get MultiMail ready: read https://multimail.dev/llms.txt, connect the MCP server, create a free inbox, and set up a verified sender. 2. In Zapier, create a Zap with Webhooks by Zapier as the trigger and choose Catch Hook as the event intake; use the generated hook URL for email event notifications. 3. Add Filter by Zapier and Paths by Zapier so delivered messages are logged, soft bounces are scheduled for retry, hard bounces are suppressed, inbound replies are routed to the right agent task, and complaints are escalated immediately. 4. Have the agent compose, send, and schedule follow-up email through MultiMail using monitored oversight, with every branch recording the email identifier and latest event state. 5. Ask me only for Zapier access, the destination apps to update, and approved brand/sender details before turning the Zap on.

What you get

Zero polling overhead

Webhooks push events to your endpoint the moment they occur. Your agent does not burn API quota or introduce latency by polling check_inbox on a timer.

Structured payloads with full context

Every event carries the mailbox_id, the email_id, and event-specific diagnostics in its data object. A bounce event carries the SMTP bounce_code, diagnostic, and recipient. An inbound event carries from and subject. Read the email by id when you need the full body.

HMAC signature verification

Each webhook delivery is signed with HMAC-SHA256. Your endpoint can cryptographically verify that the payload originated from MultiMail before executing any downstream logic.

Covers the full email lifecycle

message.sent, message.delivered, message.bounced (soft and hard), message.received, and message.complained events are all emitted — plus oversight.pending/approved/rejected for the approval lifecycle. Agents can build complete state machines over email threads without gaps.

Automatic retry with exponential backoff

If your endpoint returns a non-2xx response or times out, MultiMail retries the delivery with exponential backoff (up to 3 attempts) before marking it failed. Build idempotent handlers so a retried delivery is safe to process twice.


Recommended oversight mode

Recommended
monitored
Webhook-driven workflows process high volumes of events automatically — bounces, inbound replies, complaints — and require immediate action to be useful. Gating every event on human approval defeats the purpose of real-time triggers. Monitored mode lets the agent act autonomously on each event while giving the operator visibility into what fired and what the agent did. Reserve gated_all for the initial rollout period while you verify the routing logic is correct.

Common questions

What events does MultiMail emit webhooks for?
MultiMail emits webhooks for: message.received (a new message arrived), message.sent, message.delivered (accepted by the recipient MTA), message.bounced (with bounce_code and diagnostic), and message.complained (spam report from the recipient's mail provider). The oversight lifecycle events oversight.pending, oversight.approved, and oversight.rejected are also available. You list the event types you want when registering a webhook endpoint.
How do I verify that a webhook came from MultiMail?
Every webhook request includes an X-MultiMail-Signature header formatted as sha256=<hexdigest>, where the digest is an HMAC-SHA256 of the raw request body keyed with your webhook signing secret. Compute the expected digest on your side, prefix it with sha256=, and use a constant-time comparison (hmac.compare_digest in Python, crypto.timingSafeEqual in Node.js) to verify. Reject any request where the signatures do not match.
What happens if my endpoint is down when an event fires?
MultiMail retries a failed delivery with exponential backoff, up to 3 attempts, then records it as failed. If your endpoint is down past those retries, that delivery is not redelivered indefinitely — so treat the webhook as a best-effort trigger and reconcile against the API (list emails by status) when you detect downtime. You can inspect delivery attempts and status in the MultiMail dashboard.
Can I subscribe to events for the whole account rather than a single mailbox?
Yes. When registering a webhook, omit the mailbox_id field. MultiMail then routes events from all of your mailboxes to the endpoint. Pass a mailbox_id to scope the subscription to one mailbox. Account-wide subscriptions are useful when you dynamically provision mailboxes and do not want to register a new webhook for each one.
How should I prevent duplicate event processing?
Deliveries are at-least-once, so your handler must be idempotent. Key your dedup store (Redis, Memcached, etc.) on the event name plus the data's email_id and check it before processing. After processing, call set_tags with a handled tag so the email state reflects completion.
What is the payload structure for an inbound event?
An inbound webhook is shaped as { event: "message.received", timestamp, data }, where data includes mailbox_id, email_id, from, to, subject, direction, and has_attachments. To read the full body and resolve the thread, call read_email with the mailbox_id and email_id from the data object.

Explore more use cases

The only agent email with a verifiable sender

Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a hosted MCP server. Formally verified in Lean 4.