Send emails from any framework
One email API for transactional and marketing email. Pick your framework for the exact file, environment setup, and send call.
✓Free to start. Unlimited contacts on every tier.
One request, complete trace
Request
POST /api/v1/emails
Authorization: Bearer aem_…
Idempotency-Key: welcome-8f21
{ "to": "[email protected]", "template": "welcome" }
202 Accepted
{ "id": "msg_7ca31", "status": "queued" }
[ 01 / 05 ]Quickstart
How do I send email from my framework?
The same three steps everywhere. Each guide shows where they go in your framework.
Get an API key
Open Settings → API & MCP and create a key with the Send + manage permission (the default). It starts with aem_ and is shown once.
Keep it on the server
Store it as a server-side environment variable. Never put it in a public or client-bundled variable, such as NEXT_PUBLIC_ or VITE_.
EnvironmentAEM_KEY=aem_…Send the email
POST to the email API from your server code. The Idempotency-Key header makes retries safe: the same key never sends a second email.
HTTPPOST https://sendandretain.com/api/v1/emails Authorization: Bearer $AEM_KEY Idempotency-Key: welcome-123 Content-Type: application/json { "to": "[email protected]", "template": "welcome" }Check the response
A 202 means queued, not delivered. Keep the id, then follow delivery in the message log or through a signed webhook.
202 Accepted{ "id": "msg_7ca31", "status": "queued" }
[ 02 / 05 ]Example prompts
What can you ask your coding agent to do?
Claude Code, Cursor, and Codex can do these over the Send & Retain MCP server, in any framework. Automations they build stay paused until you turn them on.
Welcome email
“Add a welcome email to our signup route using Send & Retain, with an idempotency key.”
Key audit
“Check this repo for any email API key that could reach the browser and move it server-side.”
Webhook
“Add an endpoint that verifies Send & Retain delivery webhooks and marks bounced users in our database.”
Trial automation
“Send a trial_started event from our app and build a paused trial-conversion automation for it.”
[ 03 / 05 ]Marketing email
Can I send marketing emails from my framework too?
Yes. Send an event when a user signs up, starts a trial, or goes quiet, and an automation sends the right email. Automations start paused, and every email goes to one person: no newsletter blasts.
- Transactional and marketing email share one contact record and one unsubscribe list.
- Unsubscribes, bounces, and complaints are suppressed for you before every send.
- Templates are react.email components; published versions never change under you.
[ 04 / 05 ]Framework or language?
Should I read a framework guide or a language guide?
Framework guides show where the send goes: Route Handlers, actions, jobs, or services. Language guides focus on the HTTP client, errors, and webhook checks. Both use the same API.
- Start with a framework guide when you're not sure which file the send belongs in.
- Start with a language guide when you know the architecture and want request-level code.
- Use the API reference for the exact operation, payload, or error shape.
[ 05 / 05 ]Frameworks
Which framework do you use?
Fifteen guides, each with the file, the environment setup, and a send call you can copy.
Next.js
Route Handlers and Server Actions.
Nuxt
Nitro server routes and private runtime config.
Vite
A small backend beside your Vite frontend.
Express
An Express route or service module.
Hono
A Hono handler on Node or Cloudflare Workers.
Remix
Actions and resource routes.
SvelteKit
+server.ts routes and form actions.
Astro
API routes with an SSR adapter.
Laravel
Queued jobs, listeners, and controllers.
Django
Views, services, and Celery tasks.
FastAPI
Endpoints and background workers.
Rails
Service objects and ActiveJob.
Spring Boot
Spring services and scheduled jobs.
ASP.NET
Minimal APIs, controllers, and hosted services.
Phoenix
Contexts and Oban jobs.
Languages
Guides by language: Node.js, Python, PHP, Ruby, Go, Java, .NET, Elixir, and Rust.
Questions people ask us
Send your first email from your framework today.
Pick your guide, create a key, and watch the email land in the message log.