AI agents write in markdown. MultiMail renders consistent, branded HTML and routes sends through your approval workflow before delivery.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 queuedPass 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.
{
"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.
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.
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.
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.
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.
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.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 50-tool MCP server. Formally verified in Lean 4.