Email webhooks
Know exactly what happened to every email. Webhooks push delivery, engagement and inbound events to your endpoint the moment they happen.
email.sent, delivered, delivery_delayed, bounced, complained, opened, clicked, failed and received, plus contact.* and domain.* events.
Each request carries a timestamped signature over the raw body, so you can reject forged or replayed events. The SDK verifies it in one line.
Failed deliveries are retried after 30 s, 2 min, 10 min, 1 h and 6 h: six attempts in total.
Inspect every attempt's status code, response body and latency, and redeliver any event with a click.
Subscribe each endpoint to only the events it needs, and add as many endpoints as your plan allows.
Endpoints must be public HTTPS URLs; private and internal addresses are blocked on every attempt.
import { verifyWebhook } from "stackemails";
export async function POST(req: Request) {
const raw = await req.text();
const ok = await verifyWebhook(
raw,
req.headers.get("x-stackemails-signature-v2"),
process.env.STACKEMAILS_WEBHOOK_SECRET!,
);
if (!ok) return new Response("invalid signature", { status: 401 });
const event = JSON.parse(raw);
if (event.type === "email.bounced") {
// mark the address as invalid in your database
}
return new Response("ok");
}Any 2xx response within 10 seconds. Anything else, including redirects, is treated as a failure and retried.
Yes, retries mean an event can occasionally be delivered twice. Deduplicate using the event id.
Transactional email API
Password resets, magic links, receipts and alerts, all sent through one clean endpoint, authenticated on your domain and tracked from request to inbox.
Inbound email & inboxes
Turn incoming email into structured data. Receive replies, support requests and forwarded documents on your domain, and act on them by webhook or from a shared inbox.
MCP server for AI agents
A native Model Context Protocol server lets AI assistants send and read email through Stack Emails, with the same guardrails as your API.
Create a free account, verify your domain and send in minutes.