Inbound Drafts / Docs

Inbound Drafts

Inbound Drafts turns an email or an HTML payload into an editable newsletter draft. Send by email or by API; the result is the same. Nothing is sent to subscribers until someone presses send in the app.

Host names on this page are examples.

Quickstart

1. Create an inbound source

In the app, open Settings, then Inbound sources, then New source. Give it a name, such as “Weekly industry report”. Choose a default list, and whether to apply your brand style or keep the original design. Add the addresses or whole domains allowed to send. Copy the inbound address and create an API key; the key is shown once.

Each source gets its own private address in the form <name>-<random>@in.mape.email.

2a. Send by email

Send the report as a normal email to your inbound address, from an allowed sender, through the mail system you already use.

FieldValue
ToYour inbound address, for example weekly-report-k7f3q9@in.mape.email
FromAn address on the source’s allowed list. Your domain must publish SPF or sign its mail with DKIM
SubjectBecomes the newsletter subject line
BodyThe HTML part is used. A plain-text or Markdown body works too
Python
import smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["Subject"] = "Industry report, week 47"
msg["From"] = "reports@yourcompany.com"
msg["To"] = "weekly-report-k7f3q9@in.mape.email"
msg["X-Inbound-Template"] = "weekly-report"
msg.set_content("Plain-text version of the report")
msg.add_alternative(open("report.html").read(), subtype="html")

# Your own company mail server, not ours
with smtplib.SMTP("smtp.yourcompany.com", 587) as s:
    s.starttls()
    s.login("reports@yourcompany.com", "YOUR_MAIL_PASSWORD")
    s.send_message(msg)

Treat the inbound address like a password. If it leaks, regenerate it in the source’s settings; the old address stops working at once.

2b. Or send by API

Shell
curl https://api.mape.email/v1/inbound/messages \
  -H "Authorization: Bearer $INBOUND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "Industry report, week 47",
    "html": "<h1>Week 47</h1><p>Three things moved this week.</p>",
    "template": "weekly-report",
    "idempotency_key": "report-2026-w47"
  }'

The response returns at once:

Response, 202
{ "id": "inm_01HXYZ", "status": "processing" }

Markdown is the cleanest input of all. Send it in place of html:

Shell
curl https://api.mape.email/v1/inbound/messages \
  -H "Authorization: Bearer $INBOUND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "Release notes, version 2.4",
    "markdown": "# Version 2.4\n\n- Faster exports\n- Dark mode for charts"
  }'

Or send a whole email as it would leave your mail system:

Shell
curl https://api.mape.email/v1/inbound/messages \
  -H "Authorization: Bearer $INBOUND_API_KEY" \
  -H "Content-Type: message/rfc822" \
  --data-binary @report.eml

2c. SMTP, upon request

If your system can only send through an SMTP server with a username and password, ask for SMTP access. We will tell you when it is available for your account. Until then, the email address in 2a works with any system that can send an email.

3. Wait for the draft

Poll GET /v1/inbound/messages/{id} or subscribe to the inbound.ready webhook. When the status is ready, the response includes draft_id and a link to open the draft in the editor.

Shell
curl https://api.mape.email/v1/inbound/messages/inm_01HXYZ \
  -H "Authorization: Bearer $INBOUND_API_KEY"
Response
{
  "id": "inm_01HXYZ",
  "status": "ready",
  "error": null,
  "draft_id": "drf_01HXZA",
  "draft_url": "https://app.mape.email/campaigns/drf_01HXZA",
  "ai_usage": { "credits_charged": 1 }
}

The status goes from received to processing, then to ready or failed. A failed message never leaves a half-built draft.

4. Review, preview, send

Open the draft and edit it. Check the desktop and mobile previews, dark mode, images off, the plain-text version and the inbox line (from name, subject and preheader). Send yourself a test, then send to your list or segment. Click and open tracking is added only when you send, so the draft and the previews stay clean. Opens are an estimate, because some mail apps load images on their own.

Options

The inbound source holds the defaults. Any message can override them.

Email headerAPI fieldMeaning
Subject subject Newsletter subject line
X-Inbound-Title title Internal draft name
X-Inbound-List list List or segment to pre-select
X-Inbound-Template template Template to apply; none keeps the original design
X-Inbound-Idempotency-Key idempotency_key Prevents duplicate drafts for 24 hours
X-Inbound-AI ai off (email) or false (API) cleans this message with rules only

Senders that cannot set headers can pick the template in the address itself: weekly-report-k7f3q9+weekly-report@in.mape.email. A header wins over the address.

The API also accepts text or markdown in place of html, an attachments array (filename, content_type, content_base64 and an optional content_id for inline images), and a raw MIME message with Content-Type: message/rfc822.

Writing HTML that converts well

  • Use plain structure: headings, paragraphs, lists, images, links, simple data tables.
  • Give images real dimensions and alt text.
  • Skip scripts, forms, video and external stylesheets. They are removed.
  • Attach images, embed them, or link to them. All three are copied to our servers.
  • Phone photos are fine. HEIC and AVIF, like WebP and SVG, are converted to JPEG or PNG, which every inbox shows.
  • Anything we cannot turn into blocks is kept as it is, in a block you can edit as code.

What we change

We remove unsafe markup, strip mail-client and Word leftovers, forwarding headers and email signatures, inline CSS, rebuild layout and buttons for older clients, convert unsupported image formats and generate a plain-text version. Images are resized to at most 1,200 px wide, with location and camera data removed. Every change is listed in the draft’s “What we changed” panel, and the original is always kept: you can put back anything we removed, compare with the original or go back to it.

At send time we add the unsubscribe link, your postal address and one-click unsubscribe headers. They cannot be removed.

AI usage and credits

Most cleanup is done by fixed rules. A model is called only for the hard parts, such as telling a signature from content or mapping messy HTML to blocks. Removing unsafe markup never uses AI. When AI is used, the email usually costs 1 credit. An email over 100 KB of HTML (images excluded) or 60 content blocks costs 1 more credit for each further 100 KB or 60 blocks started. Each inbound source has a “most credits per email” setting, 3 credits by default; above it we finish with rules only and flag the draft, with a button to clean it up with AI at the price shown.

  • The message status includes an ai_usage object with the credits charged, and each draft shows the credits it used.
  • If your credits cannot cover it, we skip the AI step, finish with rules only and flag the draft. The message is never rejected for lack of credits.
  • Retries caused by our errors and duplicates caught by idempotency_key are not charged.
  • Set "ai": false in the API, or the X-Inbound-AI: off header on an email, to process a message with rules only. You can also switch AI off for a whole source.
  • A monthly credit cap per source and the quota.low webhook, sent when 80% of your credits are used, are in the inbound source settings.
  • Credits come from the same monthly balance as every other AI feature. Need more? 100 credits for $20, good for 12 months. Nothing is bought automatically. See pricing.

Limits

LimitValue
Message size, attachments included25 MB
HTML body, before cleanup2 MB
Messages per source60 an hour
Images and files per message50, up to 10 MB each

A remote image that cannot be fetched does not fail the draft. Its block shows a placeholder and a warning.

Errors

A rejected email gets no reply and no bounce, because a bounce to a forged sender would be abuse. Look in the inbound log, or subscribe to the inbound.rejected webhook.

WhereSignalMeaning
Email Log reason unknown_address The inbound address is wrong or was regenerated
Email Log reason sender_not_allowed The From address is not on the source’s allowed list
Email Log reason auth_failed Neither SPF nor DKIM passed for the From domain
Email Log reason spam_or_virus The email failed the spam or virus scan
Email Log reason too_large The message is over the size limit
Email Log reason rate_limited The source sent more than 60 messages in the last hour
Email Log reason source_disabled The inbound source is switched off
API 401 Missing or invalid API key
API 413 Payload too large
API 429 Rate limit reached
Either status failed Processing failed; the error field says why

Webhooks

Events: inbound.ready, inbound.failed, inbound.rejected, draft.sent and quota.low. Each call is signed with the secret shown once when you create the webhook, in a Mape-Signature: t=<unix time>,v1=<hex> header, where the hex value is an HMAC-SHA256 of the timestamp, a dot and the request body.

How this differs from Mailchimp’s Email Beamer

Email Beamer creates a draft from an email sent to a private address. Inbound Drafts adds a list of allowed senders, an API for automated senders, cleanup with a visible change list, your brand style applied, and previews on desktop and mobile. See the comparison.