Every dashboard action is an MCP tool your agent can call.Read the docs

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.

Server quickstart
Frameworks

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" }

RuntimeServer process
RequestPOST /api/v1/emails
Result202 · queued
Credentials stay server-side

[ 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.

  1. 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.

  2. 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_.

    Environment
    AEM_KEY=aem_…
  3. 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.

    HTTP
    POST https://sendandretain.com/api/v1/emails
    Authorization: Bearer $AEM_KEY
    Idempotency-Key: welcome-123
    Content-Type: application/json
    
    { "to": "[email protected]", "template": "welcome" }
  4. 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.

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.