Email Without Static Templates

AI agents write in markdown. MultiMail renders consistent, branded HTML and routes sends through your approval workflow before delivery.


Why this matters

Static email templates assume you know every variation in advance. For AI agents, that assumption breaks immediately — agents need to personalize subject lines, restructure content, add or omit sections based on context, and vary tone by recipient segment. Template libraries built for human marketers don't accommodate that flexibility. But unconstrained generation produces inconsistent formatting: mismatched heading levels, raw markdown appearing in HTML contexts, missing unsubscribe footers, brand colors applied incorrectly. The result is emails that look unfinished or fail deliverability checks.


How MultiMail solves this

MultiMail accepts markdown from your agent and converts it to formatted HTML through a controlled rendering pipeline. Brand tokens — logo, color palette, font stack, footer — are applied at render time, so agents never handle HTML directly. The rendered output goes into the approval queue before delivery, giving your team a chance to review at high volume without blocking every message. Agents compose with structure; MultiMail enforces visual consistency.

1

Agent generates markdown content

Your agent produces the email body in standard markdown — headings, lists, code blocks, links. No HTML, no inline styles. Subject line and recipient are passed as structured fields alongside the markdown body in the send_email call.

2

MultiMail renders HTML with brand tokens

The send_email API converts markdown to HTML using your mailbox's brand configuration: logo URL, primary color, font stack, and footer template. Rendering happens server-side before the message enters any queue. Raw HTML passthrough is disabled to prevent prompt injection via generated content.

3

Message queues for approval

With gated_send oversight, the rendered message enters the pending queue. Your team retrieves it via list_pending and reviews the final HTML output — not raw markdown — before approving or canceling via decide_email.

4

Delivery and webhook confirmation

Approved messages are delivered and a webhook fires with delivery status. Your agent can call get_thread to confirm receipt and update downstream state — closing the loop between generation and confirmed delivery.


Implementation

Send a dynamically composed markdown email
python
import multimail

client = multimail.Client(api_key="mm_live_...")

"cm"># Agent-generated markdown — structure varies per recipient
markdown_body = """
# Your onboarding checklist, Casey

Based on your account setup, here are the next three steps:

1. **Connect your first mailbox** — takes about 2 minutes
2. **Set an oversight mode** — start with `gated_send` while you evaluate
3. **Send a test message** — use the sandbox key `mm_test_...`

Your trial includes 200 emails and expires on 2026-05-19.

Reply to this email if you hit any issues.
"""

result = client.send_email(
    from_address="[email protected]",
    to_address="[email protected]",
    subject="Your personalized onboarding checklist",
    body=markdown_body,
    body_format="markdown",
    oversight_mode="gated_send"
)

print(result["message_id"])  "cm"># queued, pending approval
print(result["status"])       "cm"># "pending_approval"

The agent generates personalized markdown and passes it to send_email with body_format set to markdown. MultiMail handles HTML conversion and brand application before queuing for approval.

Inspect and action the approval queue
python
import multimail

client = multimail.Client(api_key="mm_live_...")

"cm"># Retrieve messages waiting for approval
pending = client.list_pending(mailbox="[email protected]")

for msg in pending["messages"]:
    print(f"Subject : {msg[&"cm">#039;subject']}")
    print(f"To      : {msg[&"cm">#039;to']}")
    # html_preview contains the fully rendered, brand-applied output
    print(f"Preview : {msg[&"cm">#039;html_preview'][:300]}")

    # Approve or cancel based on review
    client.decide_email(
        message_id=msg["message_id"],
        decision="approve"  # or "cancel"
    )

Use list_pending to retrieve rendered HTML for review, then decide_email to approve or cancel each message before delivery.

REST API: send markdown email
bash
curl -X POST https://api.multimail.dev/v1/send_email \
  -H "Authorization: Bearer $MULTIMAIL_API_KEY..." \
  -H "Content-Type: application/json" \
  -d &"cm">#039;{
    "from": "[email protected]",
    "to": "[email protected]",
    "subject": "Your personalized onboarding checklist",
    "body": "# Your onboarding checklist, Casey\n\n1. **Connect your first mailbox**\n2. **Set an oversight mode**\n3. **Send a test message**\n\nReply with any questions.",
    "body_format": "markdown",
    "oversight_mode": "gated_send"
  }&"cm">#039;

Direct API call for agents not using the Python SDK. Set body_format to markdown to trigger the rendering pipeline.

Dry-run: preview rendered HTML before queuing
python
import multimail

client = multimail.Client(api_key="mm_live_...")

preview = client.send_email(
    from_address="[email protected]",
    to_address="[email protected]",
    subject="Your personalized onboarding checklist",
    body="# Hi Casey\n\nHere is your plan.\n\n- Step one\n- Step two",
    body_format="markdown",
    oversight_mode="gated_send",
    dry_run=True
)

print(preview["rendered_html"])   "cm"># full HTML with brand applied
print(preview["brand_tokens"])    "cm"># logo, colors, footer that were applied
"cm"># no message_id returned — nothing was queued

Pass dry_run=true to get the rendered HTML and applied brand tokens back without creating a pending message. Useful during development to verify output before connecting live generation logic.

MCP: send markdown email from Claude Desktop
json
{
  "tool": "send_email",
  "parameters": {
    "from": "[email protected]",
    "to": "[email protected]",
    "subject": "Your personalized onboarding checklist",
    "body": "# Hi Casey\n\nBased on your setup:\n\n1. **Connect your first mailbox**\n2. **Review oversight settings**\n3. **Send a test via sandbox key**\n\nReply with questions.",
    "body_format": "markdown",
    "oversight_mode": "gated_send"
  }
}

Agents running in MCP-compatible clients call send_email directly. The body_format parameter is supported across all MultiMail MCP tools.


What you get

No template maintenance

Agents compose from context, not templates. When onboarding steps change, update the agent's prompt — not an HTML file. There is no template library to version or synchronize with generation logic.

Consistent brand output regardless of generation variance

Brand tokens are applied server-side at render time. Agents cannot produce off-brand output because they never write HTML — they write markdown, and MultiMail adds the visual layer deterministically.

Reviewers see exactly what recipients see

The gated_send approval queue exposes the rendered HTML output, not raw markdown. Reviewers inspect the final formatted email — including brand treatment and footer — before approving delivery.

Scales without template sprawl

A single agent can generate thousands of distinct, personalized emails without a corresponding library of templates. Content variety is the agent's job; visual consistency is MultiMail's.

Deliverability-safe by construction

The rendering pipeline applies required compliance footers, validates HTML structure, and escapes raw HTML from agent output before queuing. Malformed markup from generation edge cases cannot reach recipients.


Recommended oversight mode

Recommended
gated_send
Dynamically generated content varies by design — that is the point. But high-volume personalized email at scale carries real risk if generation regresses: a bad prompt, a context join error, or a data access fault could queue thousands of incorrect messages before anyone notices. gated_send lets agents compose freely and queue in bulk while giving a reviewer a final check on the rendered output before delivery. For mature pipelines with well-tested generation logic, move to monitored to retain the notification trail without requiring explicit approval on every send.

Common questions

Which markdown features does the rendering pipeline support?
MultiMail supports CommonMark plus GitHub Flavored Markdown (GFM) tables and task lists. Raw HTML passthrough is disabled — HTML tags in the markdown body are escaped, not rendered. This prevents agents from inadvertently passing prompt-injected HTML through to recipients.
How are brand tokens configured?
Brand tokens — logo URL, primary color hex, font stack, footer HTML — are set per mailbox via the create_mailbox API or account dashboard. Once configured, they apply automatically to every markdown-rendered send from that mailbox. Agents do not pass branding parameters at send time.
Can agents include images or attachments in generated emails?
Yes. Pass image URLs using standard markdown syntax (`![alt](https://cdn.acme.com/image.png)`). For attachments, include a base64-encoded payload or hosted URL in the attachments field of the send_email call. The rendering pipeline handles embedding and inline CID references for email client compatibility.
What happens if the approval queue grows faster than reviewers can process it?
Messages stay queued until acted on — there is no automatic expiry. You can call cancel_message to clear stale messages individually, or switch the mailbox to monitored oversight to allow delivery while retaining a notification trail. list_pending supports filtering by age, subject pattern, and recipient for triage at volume.
Does dynamic generation work with reply threads, not just new messages?
Yes. reply_email accepts the same body and body_format parameters as send_email. The rendered reply is inserted into the existing thread with correct In-Reply-To and References headers so it appears in-thread in the recipient's email client.
Can I set different brand configurations for different mailboxes on the same account?
Yes. Each mailbox carries its own brand token set. An account can have a transactional mailbox (minimal styling) and a marketing mailbox (full brand treatment) with different logo, color, and footer configurations. Agents select the sending mailbox; MultiMail applies the corresponding brand.

Explore more use cases

The only agent email with a verifiable sender

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