Postmark Inbound Alternative: Addresses by API, Signed Webhooks

A Postmark inbound alternative: an address per customer by API call, HMAC-signed webhooks, messages read by id, and a Python port of a Postmark handler.

By · · 13 min read

Python code that creates one Mailcycle address per customer and saves its id, in place of a Postmark MailboxHash

Postmark gives each server one inbound address, a long hash at inbound.postmarkapp.com, and posts every message that reaches it to a single webhook URL as JSON. Teams that run on it often split that one address into many with plus addressing, so hash+acme@inbound.postmarkapp.com belongs to one customer and hash+invoices@ to another, and the handler reads the MailboxHash field to tell them apart. If you are weighing a Postmark inbound alternative, this guide shows that handler on Mailcycle, where each of those tags becomes a real address made by API call, every delivery is signed, and the message is read by id.

The code below is Python with Flask, since that is a common home for a Postmark inbound handler. Every call has a TypeScript twin, and seven more SDKs cover the other languages.

Everything said here about Postmark is taken from Postmark’s developer documentation and pricing page, read on 28 November 2026. The source for each point is in the table at the end.

How Postmark inbound is put together

Postmark organises mail by server, and inbound mail goes through a server’s Inbound Message Stream. The configuration guide says “you can only create one Inbound Stream per Server, and add only one domain to that Stream”, and the webhook page adds that “each Inbound Message Stream has one inbound webhook URL”. So the unit you configure is the server: one stream, one inbound address, one optional domain and one URL.

The inbound hash address and MailboxHash

Postmark’s overview describes inbound as sending mail to hash@inbound.postmarkapp.com. In Postmark’s words, “a server’s inbound mailbox is a unique hash generated when the server is created”, and you find it as the InboundHash on the stream settings page or from GET /servers/:serverid.

To route within that mailbox, Postmark splits plus addressing out for you. Mail to user+12345@example.com arrives with MailboxHash set to 12345, and Postmark’s own example shows 451d9b70...+ahoy@inbound.postmarkapp.com producing "MailboxHash": "ahoy". Many Postmark inbound handlers branch on that one field.

Inbound domain forwarding with an MX record

For mail on your own domain, Postmark’s domain forwarding guide asks for “an MX record that points to inbound.postmarkapp.com” with priority 10, and the guide notes that “inbound domains are unique across Postmark and are Stream-specific”.

The inbound JSON webhook

Each message is posted to the stream’s URL as one JSON document. The sample payload carries fields such as From, To, OriginalRecipient, Subject, MessageID, ReplyTo, MailboxHash, Date, TextBody, HtmlBody and Attachments, with each attachment’s Content as base64 inside the body.

Postmark protects the URL with HTTP Basic auth written into it, such as https://username:password@example.com/inboundhook, and recommends combining that with “allowlisting Postmark’s IP ranges”. Its webhooks overview states that “Postmark does not currently support HMAC webhook signature verification.”

If the endpoint does not answer 200, Postmark retries with “a total of 10 retries”, at 1, 5, 10, 10, 10, 15 and 30 minutes, then 1, 2 and 6 hours, a little over ten hours in all. A 403 stops the retries, and a message whose retries all fail shows as Inbound Error until you retry it.

Postmark plans that include inbound

On Postmark’s pricing page, “Inbound email processing” is listed on the Pro plan, “for start-ups and small businesses”, and on the Platform plan, “for agencies and larger teams”.

The Mailcycle model in one paragraph

Mailcycle starts from addresses you create in code. mc.addresses.create() returns a working address on a shared Mailcycle domain, and mail sent to it is encrypted on arrival with that address’s own key. Every webhook subscribed to message.received then gets a small JSON event, signed with its own secret, naming the message and the address. Your handler reads the message by id, and the SDK opens it in your process.

Flow: your code creates an address for each customer, mail is encrypted on arrival, a signed event names the address, and your handler reads the message by id
The tag you used to put after the plus sign becomes an address of its own.

From MailboxHash to an address per customer

A MailboxHash is a string the sender has to type correctly, and your code has to parse and trust it. A Mailcycle address is a row in your database: you create it when you create the customer, store its id, and every event for it arrives with that id.

Creating the addresses in Python

import os
from mailcycle import Mailcycle

mc = Mailcycle.with_api_key(
    os.environ["MAILCYCLE_API_KEY"],
    phrase=os.environ["MAILCYCLE_PHRASE"],
)

def give_customer_an_inbox(customer):
    address = mc.addresses.create(prefix=customer.slug, label=customer.name, retention_days=30)
    customer.inbox_id = address.id
    customer.inbound_address = address.email_address
    customer.save()
    return address.email_address

The server adds a random ending to the prefix, so acme becomes an address like acme-x7k2@ on a shared domain, and it takes mail as soon as the call returns. Your process seals the customer’s name into the label before the request leaves it.

Where you used one Postmark server per product or environment to keep streams apart, here you simply create the addresses each one needs. Staging gets its own set, production gets its own set, and an integration test can make a fresh address per run.

What the handler looks up instead of a hash

The Postmark version of a handler usually starts like tenant = Tenant.objects.get(slug=payload["MailboxHash"]). The Mailcycle version looks up the address id that the event already carries:

def find_customer(inbox_id: str):
    return Customer.objects.filter(inbox_id=inbox_id).first()

The id arrives exactly as you stored it, so the lookup is a plain equality match.

A webhook you can verify by signature

Add the webhook in the web app under API, on the Webhooks tab, choose message.received and copy the whsec_ secret, which is shown once. Each delivery is a POST whose JSON body holds an event id, its type, createdAt and a payload of messageId and inboxId.

The Mailcycle-Signature header reads t=<unix seconds>,v1=<hex>, where the hex is an HMAC-SHA256 of the timestamp, a full stop and the raw body. The secret belongs to that one webhook, and an account can hold 10 webhooks, each with its own URL, its own list of events and its own secret.

Keeping your Basic auth check

If your Postmark endpoint checks Basic auth today, it can keep doing so. When you add the webhook, choose Add a header and give it Authorization with the Basic ... value your receiver expects. Mailcycle sends that header on every delivery, and the value is never shown again after you save it. You end up with the old check and an HMAC signature on the same request.

A Flask receiver

import json
import os
from flask import Flask, request
from mailcycle import verify_webhook_signature

app = Flask(__name__)
SECRET = os.environ["MAILCYCLE_WEBHOOK_SECRET"]

@app.post("/inbound/mailcycle")
def inbound():
    raw = request.get_data()
    if not verify_webhook_signature(SECRET, raw, request.headers.get("Mailcycle-Signature")):
        return "", 401
    event = json.loads(raw)
    if event["type"] == "message.received" and first_time(request.headers["Mailcycle-Event-Id"]):
        queue.enqueue(handle_message, event["payload"]["inboxId"], event["payload"]["messageId"])
    return "", 204

verify_webhook_signature takes the bytes from request.get_data() directly and compares in constant time. Answer within 10 seconds and do the slow work in your job queue. The production version of this receiver, with deduplication on Mailcycle-Event-Id, Express and FastAPI variants and local testing, lives in Receive email with a webhook.

Small events, full messages on request

A Postmark inbound post carries the whole message, attachments included as base64. A Mailcycle event carries two ids and nothing else, so the request that reaches your load balancer, tunnel or logging proxy holds no mail content at all. The message comes from GET https://api.mailcycle.email/messages/:id, and the SDK opens it:

def handle_message(inbox_id: str, message_id: str):
    customer = find_customer(inbox_id)
    message = mc.messages.get(message_id)
    if customer is None:
        return archive(message)
    ticket = customer.tickets.create(subject=message.subject, body=message.text, sender=message.from_address)
    for part in message.attachments:
        if part.mime_type == "application/pdf":
            ticket.files.create(name=part.filename, data=mc.messages.attachment(message, part.index))

Each file comes down on its own when you call mc.messages.attachment(message, index), already opened. A job that only files the subject line never downloads a large scan, and a job that wants one PDF fetches only that one.

Postmark JSON fields and where they live in Mailcycle

Postmark inbound field Mailcycle (Python SDK)
MailboxHash the address itself: inboxId in the event, address_id on the message
OriginalRecipient, To to, plus the receiving address’s id
From, FromName from_address, from_name
ReplyTo reply_to, which falls back to the sender when none was set
Subject subject
TextBody text
HtmlBody html, and safe_html with remote images and embeds removed for display
Attachments attachments, each with index, filename, mime_type, size and content_id
MessageID id, the id you read the message by
Message-ID in Headers message_id, ready for threading a reply
Date received_at, when it reached the address

Retries, replays and catching up

A Mailcycle delivery that gets no 2xx within 10 seconds is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 12 hours: eight attempts across about a day and a half. Every delivery is kept in the log for 30 days with its attempts and last response code.

Where a Postmark workflow retries failed inbound messages one by one from the activity page, a Mailcycle script can do the whole batch after an outage, with the same API key your handler uses:

page = mc.webhooks.deliveries(os.environ["MAILCYCLE_WEBHOOK_ID"], status="failed", limit=200)
for delivery in page.deliveries:
    mc.webhooks.redeliver(os.environ["MAILCYCLE_WEBHOOK_ID"], delivery.id)

A redelivery keeps the original event id, so your deduplication still works. And because each message stays at its address for that address’s retention, 7 days by default and up to 90, mc.messages.list(inbox_id) returns any address’s mail newest first whether a webhook fired or not. A nightly job that lists each busy address and compares against your tickets is a cheap second line of safety.

Encrypted on arrival with your own keys

Mail is encrypted the moment it arrives, with keys from your account’s 12-word recovery phrase, and each address has its own key pair. The phrase lives with your other production secrets, and the SDK derives the keys from it when your process starts. Trackers are stripped from safe_html, so a support screen that renders customer mail shows it without remote pixels.

For a no-code step after the webhook, the decrypt Worker runs in your own Cloudflare account, opens one address’s mail and posts the parsed message on to n8n, Make, Zapier or Pipedream. The details are in Encryption.

The same handler in nine SDKs

Postmark inbound handlers live in every stack, and so do Mailcycle’s SDKs: TypeScript, Python, Go, Rust, Java, .NET, PHP, Ruby and Swift, all Apache-2.0, each with addresses.create, a webhook signature helper and a message read. A Rails controller stays in Ruby, a Laravel route stays in PHP and an ASP.NET endpoint stays in C#. Each language has a read-side tutorial:

Install lines and references are on the SDK pages.

Handing inbound mail to an AI agent

Plenty of inbound workflows now end with a model: one that sorts support requests, reads invoices or completes a sign-up. On Scale, you give an agent its own addresses, and the mailcycle-mcp server, running on the agent’s own machine, offers it tools to list those addresses, read messages, wait for new mail and read attachments. It works with Claude Code, Claude Desktop, Cursor, Codex, VS Code or any other MCP client, and agents start reply-only.

An address made for the agent is the agent’s to read, so your webhook handler and your agent can share one account while each sees its own mail. Setup is npx -y mailcycle-mcp pair, covered in the email MCP server guide and on email for AI agents.

Your own domain on Scale

When customers should write to support@example.com, move up to Scale, which includes 10 custom domains and lets you choose the whole local part. In place of an MX record per stream, you add the domain in the app, place one TXT record to show it is yours and move its nameservers to Mailcycle, which then sets up receiving. Scale also sends from the API, so the ticket handler above can answer from the address that received the mail, with threading filled in from the original message. The own domains guide has the steps, and Role addresses on your own domain shows support@ and billing@ set up this way.

Operator or Scale for a Postmark inbound workload

Prices come from pricing and limits from plans and limits.

Your inbound workload Plan Price a month Includes
Inbound parsing for your app, on shared domains Operator $15 250 addresses, 250,000 received messages, API keys and 10 webhooks
Inbound with replies, your own domains or agents Scale $19 1,000 addresses, 750,000 received messages, 10 domains, sending from the API, agent inboxes

Operator covers a handler that only receives. Scale fits when the same flow replies, when recipients must be on your domain, or when an agent reads the mail.

Moving from Postmark inbound, step by step

  1. List each inbound server you use, with its InboundHash, its inbound domain if it has one, and its InboundHookUrl.
  2. Collect the MailboxHash values your handler branches on. Each customer, queue or feature behind a hash becomes one Mailcycle address.
  3. Create those addresses with mc.addresses.create and store each id on the record it belongs to.
  4. Add a message.received webhook pointing at the new receiver, and add your Basic auth value as a header of your own if your endpoint checks it.
  5. Swap the field reads in your handler using the table above.
  6. Publish the new addresses: reply-to headers, help pages, forwarding rules in customers’ own mailboxes and test fixtures.
  7. Run both paths for a few days and compare what each one filed, then retire the Postmark inbound stream. Bring your own domain across on Scale last.

For a complete inbound feature built on this pattern, with tickets, threading and reply by email, follow Add inbound email to your SaaS.

Testing the new receiver

Locally, a tunnel such as Cloudflare Tunnel or ngrok gives your Flask app an HTTPS URL to register, and Send test in the app fires a webhook.test event through your signature check. The same test is mc.webhooks.test(webhook_id) from a script.

For tests with no public URL at all, mc.messages.wait_for(address_id=inbox_id) returns the next message at an address, opened, so an end-to-end test can create an address, send mail to it and assert on what arrives. The event stream delivers the same events over a WebSocket to a worker that stays connected.

Troubleshooting a ported Postmark handler

Every delivery returns 401

Flask parsed the body before the check, or the check received a re-serialised dict. Pass the bytes from request.get_data() to verify_webhook_signature, and parse the JSON after it returns true.

The handler cannot find a customer for an event

The address was created before its id was saved, or by a script outside your sign-up flow. Save inbox_id in the same transaction that creates the customer, and let the archive branch log anything it cannot place.

Messages are filed twice

A slow answer led to a retry. Return 204 before doing the work, and record Mailcycle-Event-Id under a unique key so a second attempt or a redelivery is skipped.

Sources and dates

Each Postmark statement above was read on 28 November 2026 on these pages:

What Page
Inbound address hash@inbound.postmarkapp.com https://postmarkapp.com/developer/user-guide/inbound
One inbound stream per server, one domain per stream, InboundHash, InboundHookUrl, Basic auth in the URL https://postmarkapp.com/developer/user-guide/inbound/configure-an-inbound-server
MX record to inbound.postmarkapp.com, domains unique per stream https://postmarkapp.com/developer/user-guide/inbound/inbound-domain-forwarding
JSON fields, MailboxHash, one webhook URL per stream, 10 retries, 403 and Inbound Error https://postmarkapp.com/developer/webhooks/inbound-webhook
Mailbox hash per server, plus addressing, base64 attachments https://postmarkapp.com/developer/user-guide/inbound/parse-an-email
Basic auth and IP allowlisting, HMAC statement https://postmarkapp.com/developer/webhooks/webhooks-overview
Inbound email processing on Pro and Platform https://postmarkapp.com/pricing

Mailcycle figures come from https://mailcycle.email/pricing and https://docs.mailcycle.email/concepts/plans-and-limits/. Postmark is a trademark of its owner. We are not affiliated with Postmark.

FAQ

What is a good alternative to Postmark inbound?

Mailcycle suits teams that want each customer, project or workflow to have its own address. Your code creates an address with one API call on a shared domain that already receives mail, a webhook signed with HMAC-SHA256 tells you when mail lands, and your code reads the message by id with an SDK in TypeScript, Python, Go, Rust, Java, .NET, PHP, Ruby or Swift.

What replaces the Postmark MailboxHash?

The address itself. Instead of tagging one inbound address with +hash values, you create one Mailcycle address per customer or workflow and save its id on that record. Each message.received event carries the inboxId of the address that received it, so your handler looks up the record directly.

How do I verify that an inbound webhook came from Mailcycle?

Every delivery carries a Mailcycle-Signature header with a timestamp and an HMAC-SHA256 of the timestamp and raw body, keyed with that webhook's whsec_ secret. The SDK helper, verify_webhook_signature in Python and verifyWebhookSignature in TypeScript, checks it in constant time and refuses a timestamp older than five minutes.

Can I keep the Basic auth credentials my Postmark endpoint checks?

Yes. A Mailcycle webhook can send a header of your own on every delivery, such as Authorization with the value your receiver already expects. Your existing check keeps working, and the signature check runs alongside it.

Which Mailcycle plan matches Postmark inbound processing?

Operator, at $15 a month, includes API keys, webhooks, 250 addresses and 250,000 received messages a month. Scale, at $19 a month, adds 1,000 addresses, 10 of your own domains, any local part you choose, sending from the API and AI agent inboxes. Plans are listed on https://mailcycle.email/pricing.

How long does Mailcycle retry a failed inbound webhook?

A failed delivery is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 12 hours, eight attempts across about a day and a half. Each delivery stays in the log for 30 days, and any finished one can be sent again from the app or with an API key.

Do I need an MX record to receive email with Mailcycle?

On Operator, addresses are created on shared Mailcycle domains that already receive mail, so an address takes mail the moment the API call returns. On Scale you can add your own domains, proved with one TXT record, and receiving is set up for you once the nameservers point at Mailcycle.

How is inbound mail protected in Mailcycle?

Mail is encrypted the moment it arrives, with keys from your account's 12-word recovery phrase. Webhook events carry ids only, and the SDK opens each message in your own process when you read it.

Can an AI agent read the mail instead of my handler?

Yes. On Scale, the mailcycle-mcp server runs on the agent's own machine and gives Claude Code, Claude Desktop, Cursor, Codex or any other MCP client tools to list its addresses, read messages, wait for new mail and read attachments.

Receive email in code