docsOperate

Campaign sending

The engine that actually moves campaign mail: what it does, the product decisions baked into it, what an operator has to configure, and what it deliberately does not do.

memql#3323 modelled campaigns as concepts and shipped the authoring UI. It stopped before sending, because sending is a set of product decisions rather than UI. memql#3348 made those decisions and built the engine. Each one is recorded next to the code that implements it; this page is the operator-facing summary.

Related: Environment variables · Outbound delivery (the transactional outbox, which campaigns deliberately do not use — see below)


Installation defaults

Installation generates a shared unsubscribe signing key once and keeps it on subsequent runs. Local installs store it in memql-secrets; cloud installation uses memql-campaigns-unsubscribe-secret in the instance's Key Vault, delivered by the separate memql-secrets-campaigns ExternalSecret. Every replica uses the same key. Never put it in a package manifest or product repository.

The unsubscribe base URL defaults to https://api.<MEMQL_DOMAIN> on every target. An explicit MEMQL_CAMPAIGNS_UNSUBSCRIBE_BASE_URL overrides that default. The public API origin must be reachable by recipients for external delivery; a local hostname is for local testing and capture only.

For an existing installation, rerun its secret seeder before restarting the nodes with the updated engine. The seeder preserves an existing signing key. For cloud installs, seed the instance vault before applying its ExternalSecret; this separate object prevents a missing campaign key from stopping identity or database credential reconciliation. Signing-key rotation remains an explicit operation, described below, because previously issued links must keep working.

These defaults belong to the engine. Client domains, sender names and Azure resource choices belong to the instance or product repository and its saved cluster configuration; they are never engine defaults.

Checking a send locally

With MEMQL_EMAIL_TRANSPORT=capture, messages appear in the MemQL OS Email app for owner/developer review; they do not reach external inboxes. Campaigns shows this delivery mode before sending and when confirming a test. A captured test verifies rendering and local persistence, not Azure delivery.

Review the campaign's template and mark it ready before Send now or scheduling. Open the template in the editor and choose Publish after reviewing the preview. Saving keeps it as a draft. The campaign's Review template action opens that editor; send and schedule actions appear when its publication arrives through the live collection. Send a test queues a separate run using a published template and the organization’s testing audience. Ordinary campaigns do not depend on Shopify inventory: connecting an empty store, including a store belonging to another organization, cannot block their sends. Storefront newsletter enrollment keeps its explicit organization, store and audience binding.

Organization permissions

Select an organization when creating campaign work or a group. Operators who manage several organizations are asked to choose; MemQL never silently assigns new work to the installation owner's organization. A member with access to just one organization sees that organization selected.

A send requires access to the Email app and permission to update data in its organization. Reading a shared campaign or recipient list does not grant permission to send. Campaigns, audiences, templates and sending identities must belong to the same organization. The worker checks the campaign owner's current authority again before each delivery, so revoked membership also stops queued work. Test messages and single-recipient sends use the same organization permission check.

Sending readiness is checked for the selected organization and sender. The operator organization's mailbox status does not enable or block client mail. Use Check again after changing a connection; the backend also repeats the check before scheduling and sending.

Delivery records preserve the organization and authenticated owning user. Editing a shared resource preserves its existing owner; each new version separately records the user who made that change. Rule-triggered deliveries name their email rule; they do not invent a campaign relationship. Historical records are attributed only when an existing parent proves which organization owns them.

Templates in the editor

Choose Create new template from the Email app to write a template in the editor. The editor keeps the file content: Design, Source, and Split use the same editable document. The OS keeps the template list, organization, status, and archive controls. Files settings select browser VS Code (the default), desktop VS Code, or Cursor.

To make an email with a layout and a description, use New email. See Composing an email. Emails are no longer made from Files or from Make a file: those refuse with "Emails are made in the Email app."

Use Publish to save and publish the reviewed email for its organization. Publishing the same file updates that template. Resolve displayed issues first. Local files use Save to MemQL first. Publishing makes it available to send; it does not send mail. Editing a published template returns it to draft. Concurrent edits fail with a comparison prompt, and publishing requires the exact saved revision. An existing template cannot be moved to another organization by editing its file. Create a separate copy instead.

Newly queued and scheduled sends keep a frozen copy of the ready template reviewed at preflight. Later edits do not change those messages. The worker still rechecks the caller's authority and the source template's readability. Jobs queued before this change have no captured copy and retain their previous behavior; pause and recreate those jobs before editing their shared template.

Composing an email

New email is a page in the editor. It makes a template in a few clicks, and it can have MemQL write the words for you.

  1. Choose the organization the email is for.
  2. Choose a layout from the grid. The 24 layouts are drawn as grey wireframes and grouped by kind: Welcome, Letters, Articles, Announcements, Products, Promotions, News, Guides, Events and Feedback. A wireframe shows structure only. The look comes from the organization's brand kit.
  3. Give the email a name.
  4. To have MemQL write it, describe the email. You can also attach files: pictures, ZIPs and text files, up to 64 files and 16 MiB together. You can add a picture of how the finished email should look.
  5. Choose one of two buttons.
  • Start from the layout makes the template at once, with the brand kit applied, and opens it. If the organization has no brand kit yet, the layout takes a neutral look. Nothing is written for you.
  • Write it makes the same template, opens it, and starts MemQL writing the email in the background.

The template opens at once either way. You never wait for the writing.

While MemQL writes

MemQL writes the email in Claude Code on your own machine, using the Apps route. The editor opens the template read-only. It says "MemQL is writing this email" and shows how long it has been going, with Cancel. When MemQL finishes, the new email replaces the content in place. In the OS, the template shows Writing in Email, Templates. Open it there to see the same message, the time, and Cancel.

If the writing stops, the template shows Failed with a short reason, and a Retry button. Retry starts again with the layout, description and files you gave. The draft stays as the brand-applied layout until a run succeeds.

  • Only the person who asked MemQL to write the email can retry it, since the files it reads are theirs. Anyone else is told to use New email with their own files, and the OS shows Retry only to the person who asked.
  • Anyone who can write the template can cancel it. A colleague's Cancel marks the email Failed at once; the writing on the owner's machine stops at its next step.
  • If you finish the email yourself, saving or publishing it ends the failure: the template no longer shows Failed or Retry.
  • A retry never writes over a change. If the template changed since the writing began, MemQL's email is saved beside it as <name> (MemQL's version).

Write it needs two things. Without them it refuses, and nothing is created.

  • The organization needs a brand kit. Set one up in Email, Settings, Brand.
  • One of your machines needs Cockpit open, with Claude Code signed in.

MemQL never falls back to another model, and it never publishes. The result is a draft for you to review. Check the words, pictures and links. A draft may list issues, such as a button with no link. Publishing stays refused until you fix them.

What MemQL writes

  • Text in your files is used word for word. Your description fills in what the files leave out.
  • It writes the subject and preheader when your files do not give them.
  • It does not invent a claim, a price, a date, an address or a link. A button with no destination stays empty, and the draft reports it.
  • Link tags such as {{confirmUrl}} and {{unsubscribeUrl}} stay as the layout has them.
  • The logo, signature, follow line, social links, footer and reply come from the brand kit. MemQL does not write into them.
  • A layout can have blocks you may leave out, and blocks that can repeat, such as steps. A new template starts with each repeating block at its smallest size. MemQL may drop optional blocks and repeat blocks within their range. It makes no other change to the structure.

Pictures can be PNG, JPEG or GIF. An email holds at most 8 different pictures, and at most 1 MiB for each picture and 1 MiB of pictures in all. If your material is more than that, MemQL chooses fewer pictures and names the ones it left out. It does not shrink or convert pictures. The picture of the finished email is guidance only. It goes in the email only if your description asks for it. Files of other types are named in the summary and left out. The attached files are read up to 16 MiB together; a file past that is left out and named. A ZIP can hold up to 256 files and 64 MiB once unpacked. A file inside it that cannot be used, such as a picture over 24 million pixels or a ZIP inside the ZIP, is left out and named, and the rest of the ZIP is used. A ZIP with a path that leaves it, or a link, is left out whole.

If you edit the template while MemQL is writing, MemQL does not overwrite your changes. It saves its version as a new template beside yours, named <name> (MemQL's version), and says so.

What happensWhat you see
No machine with a signed-in appWrite it is refused before anything is made. The message says to open Cockpit with Claude Code signed in
The organization has no brand kitWrite it is refused, with a pointer to Brand. Start from the layout still works
Some files cannot be usedThey are named in the summary. MemQL continues without them. It stops only when nothing usable is left
MemQL cannot fix every issueIt submits anyway. The draft lists the issues
You cancel, or the machine sleeps or quitsThe template shows Failed, with the reason and Retry
Claude Code cannot be reached while it writesFailed: "Your Claude Code app could not be reached." Open Cockpit, then Retry
Anything else stops itFailed: "MemQL could not finish this email." The cause is in the cluster's log
The writing could not startThe template is still made and opens, and the editor offers Retry

From Ask

In Ask, attach your files and ask for an email. If it is not clear which organization the email is for, Ask asks. Ask then shows the layouts as wireframes, the closest first, and you pick one. You can also answer in words. After you choose, Ask starts MemQL writing. The draft is already in Email, Templates, marked Writing, and it fills in when MemQL finishes.

For developers: emailLayouts lists the layouts with their wireframes. campaignCreateTemplateFromLayout is Start from the layout. campaignComposeEmail is Write it. campaignCancelComposition and campaignRetryComposition stop and restart a run. Only an assistant gets the email tools in a conversation: emailLayoutCatalogue and startEmailComposition. The layout question uses requestUserFeedback with presentation set to layouts. Leave presentation out for a plain choice.

Brand kits

A brand kit is the look of an organization's emails. Each organization has one. The built-in layouts are plain frames. When an email is made from a layout, the kit fills in the colours, fonts and the brand blocks.

A kit holds:

  • Theme. Eight colours, a heading font and a body font. Each font is sent with an email-safe fallback.
  • Logo. A picture, its description and where it links. It can also have a version for coloured panels (onColour) and a version for full-width headers (wide). Each falls back to the logo when it is missing.
  • Signature. A photo, a name as text or a picture, and a title. Or one whole picture of the signature.
  • Follow line. One line of text above the social links.
  • Social links. A list of networks, each with an address and an icon.
  • Footer. Lines of text, links, a separator, and the space between lines. The footer must link {{unsubscribeUrl}}. It can also use {{preferencesUrl}} and {{viewUrl}}.
  • Reply. A heading, a button with a label and a link, and a note.

Only the theme, logo and footer are required. A part you leave empty is left out of the email.

Pictures are PNG, JPEG or GIF, up to 1 MiB each. You can use a picture from the Library that you uploaded. MemQL reads it as you and stores a copy in the kit, so everyone in the organization can use it. A picture that could not be read because storage did not answer says so, and saving again is the way on.

To set up a kit, go to Email, Settings, and open the Brand row for the organization. The page has the colours, fonts, pictures, footer, follow line and reply, with a live preview. The preview shows the part you are editing, on a layout that has it: Article for the colours, fonts, reply, footer and full-width header; Letter for the logo, the signature and the social links; Confirmation for the logo on coloured panels. Choose Save in the action bar. Warnings show beside the preview. They never block a save:

  • a text and background colour pair that falls under WCAG 2 AA contrast;
  • pictures that together are over 512 KiB.

An email made from a layout keeps the look it was made with. Changing the kit later does not change templates that already exist.

For developers: campaignSaveBrandKit({accountId, kit, expectedRevision}) saves a kit and answers {revision, warnings}. brandKitForAccount reads it. campaignBrandPreview renders a kit on a built-in layout without saving it. Saving needs the same organization write permission as saving a template.

The email document

A template is an email document, the *.email.json file the editor opens. It has one of two modes, and exactly one:

  • Layout mode is {subject, preheader, layout, theme, blocks}. The email is a column of blocks (pictures, headings, Markdown text, buttons, dividers, sections, columns, social links, a footer, and an HTML block for the rare case nothing else covers), drawn in the colours and fonts of a theme. MemQL writes the HTML and the plain-text part from the blocks, in the table layout that holds up in mail clients and on phones, with the rules of a 600 pixel email. layout records which layout the email started from and changes nothing.
  • Custom mode is {subject, preheader, textBody, htmlBody}: HTML you pasted or wrote, with its plain-text alternative. Its HTML is kept as written. MemQL only embeds the Library pictures it names and puts the preheader after the body tag.

Templates saved before documents existed are custom templates. They keep working as they are, and a saved draft of one can be published without saving it again.

Colours in a block are the theme's own (page, canvas, primary, secondary, accent, tint, text, muted and white), never a value of their own. A link is empty, a web, email or phone address, or exactly one of the four link tags {{unsubscribeUrl}}, {{preferencesUrl}}, {{viewUrl}} and {{confirmUrl}}, which sending replaces for each recipient. A recipient link must stand alone, never inside another address or a link label; saves and previews refuse it there too. Sentence punctuation around a bare link is allowed. No other merge tag can stand in for an address, so a recipient's own value can never become a link. A picture is artifact:<id>, a PNG, JPEG or GIF in the Library, or a data: image. An email carries at most eight pictures and 1 MiB of picture data in all, and a file is at most 2 MiB.

Pictures are read as the person who previews or saves. A picture they cannot read, such as another member's private file, is not embedded and is reported as unreadable; having its artifact id is not a way to read it. The saved document keeps the artifact: reference, and the saved HTML has the picture embedded (sent as an inline attachment, as before).

Layouts and previews

MemQL ships 24 built-in layouts, from Confirmation, Letter, Article and Spotlight to patterns such as newsletters, steps, offers and events. They are structure only, and take their look from the organization's brand kit. The Email app and the editor no longer save layouts; campaignSaveLayout still works through the API. Layouts an organization saved earlier stay in the database, and templates made from them keep working.

  • emailLayouts({accountId, includeArchived?}) lists what the organization can start from: the built-in layouts, then its own. Each row is {id, kind, name, description, category, wireframe, document, status}, and an organization's own also carry layoutId, revision and sourceArtifactId. The id (builtin:<name> or org:<layoutId>) is opaque: a client passes it on and never builds or splits one. Documents are included up to an 8 MiB answer budget. A later row may have documentOmitted: true with no document; read emailLayoutById with its layoutId before opening or previewing it. Every layout remains listed, with its metadata and order intact.
  • campaignSaveLayout({layoutId, accountId, name, description, document, sourceArtifactId, expectedRevision, action}) saves an organization's layout with the same exact-revision rule as a template. It takes a layout-mode document only. Archiving and restoring need only the revision, and an archived layout is restored before it is edited. layoutId is the bare id of the row, not the opaque id of a picker row. The Email app and the editor no longer offer a way to save a layout.
  • emailRender({document, accountId, sample?}) previews a document: it answers {subject, html, text, issues} with the pictures the caller can read embedded, sample values (displayName, email, accountName, campaignName and fields) filled in, the four link tags left as written, and each block marked so an editor can select it. {{accountName}} is the organization's name unless the sample says another. It saves and sends nothing, needs read access to the organization's data, and a node renders only a few previews at once; one asked for while it is busy is told to try again.

Saving, issues and publishing

Saving renders the document the way it will be sent and stores the subject, the plain-text part and the HTML part (what a send uses) together with the document itself, its layout and its preheader. The render finds what keeps the email from being sent as it is, and the receipt lists it as issues, each {code, block?, message} with a sentence that says what to do:

CodeThe email has
image_missinga picture block with no picture chosen
image_unavailablea picture that cannot be read: not found, not readable by the person saving, not a PNG, JPEG or GIF, or over 1 MiB
images_limitmore than eight pictures, or more than 1 MiB of picture data
link_missinga button, social link or footer link with no address
unsubscribe_missinga layout email with no {{unsubscribeUrl}} link (every built-in layout has one)
email_too_largemore than 2 MiB of HTML once its pictures are embedded

Saving works with issues, and returns the template to draft: a draft is a draft. Publishing is refused while any issue remains, with their sentences (fix these before publishing: Choose a picture for "Hero picture".), so a template that is ready is one that can go out. A document the format refuses, or an email too large to write out at all (more than 8 MiB of HTML), cannot be saved, and the answer says why.

An email that is saved with email_too_large is kept without its HTML part. It could never be sent, so there is nothing worth storing: the document and the issue are kept, and emailRender writes the email out whenever an editor asks for a preview. Saving it again after it has been made smaller stores the HTML. For the same reason a test send of such a draft is refused with that sentence; it would otherwise go out as plain text and look like a test of the email.

One template per organization and file

An editor opens a Library file, so the file says which template it is. Give sourceArtifactId (the file's artifact id) and the template already published from that file in the organization is the one saved, whatever templateId says; the first save creates it, so templateId may then be left empty. The template of a file is read with templateForSource({accountId, sourceArtifactId}), which gives its id and revision (createdAt) before a save. The same file in another organization is another template, and a person outside the organization does not find the template by the file.

The id a file gets is worked out from the organization and the file, and a template id is a name its caller chooses, so a person in another organization can save a template under that id first. The file's owner cannot see it, and their first save of the file is refused with a sentence that says what happened: "This file is already linked to a template you can't open. Save it with a different template." Any other refusal of a first save keeps its own words.

The write surface

The client write surface is campaignSaveTemplate, with templateId (optional when sourceArtifactId is given), accountId, name, content (the email document, in either mode), sourceArtifactId, expectedRevision, and action (save, publish, archive or restore). Its receipt is {templateId, revision, status, saved, issues}: the id of the template written, which for a file is the template the file already had, the revision to name in the next call, the status (draft, ready or archived), and the issues of the email, an empty list when there are none.

  • save renders the document and writes it as a draft. An unchanged email answers with the receipt it already has instead of writing another version, so a retry after a lost response, and an autosave of unchanged bytes, are safe.
  • publish needs the exact saved revision and the exact saved content, and is refused while the email has issues.
  • archive and restore need only the exact revision. The content in the call is ignored (a client that holds only the template's card may send an empty object), the stored content is written back as it is, and one that is already done answers with its receipt. restore returns an archived template to draft; it publishes nothing.

A save renders the document before it takes any lock, so a render that is slow (a picture to read, a busy node) never holds one. What runs under the locks is short: read the template as it is now, compare, check the revision, write. When another save of the same template is in progress and the lock cannot be taken in time, the answer is "Someone else is saving this template. Try again in a moment." and repeating the same call is safe. A lock that fails for any other reason (no database to coordinate through, a connection that was lost or timed out) is reported as the engine reported it, since trying again in a moment would not help. The organization and the permission are checked once more under the locks, so a save whose render outlasted a change to either is refused.

Raw template writes and the underlying create/update mutations are internal.

Reading templates

A list never carries an email's content. templates({status?}) answers one light row per template, {id, ownerUserId, name, subject, status, accountId, layoutId, preheader, sourceArtifactId, createdAt}, and templateForSource answers only the template's id and its revision (createdAt). The email document and its HTML and plain-text parts are read by id with templateById({templateId}). An email can weigh megabytes, and a list is up to fifty of them in one answer, so a client that needs a template's content asks for that one template. A list row is enough to archive or restore a template, which need only its revision (createdAt), but not to edit or publish it: those send the content, so the client reads it by id first.

Configure Azure once for the cluster

An owner or developer configures Settings → Connections → Email once for this installation. There is one Azure configuration, shared by every client organization in the cluster. Clients do not need Azure accounts or separate Microsoft sign-ins when the operator runs their email on its own subscription. Email manages client domains and senders; it links to Settings when the cluster needs configuration.

  1. Sign in with Microsoft. Enter the displayed code on Microsoft's page. MemQL requests delegated Azure Resource Manager access under your Microsoft account. Your tenant may require administrator consent. No password, client secret, or subscription key is entered into MemQL.
  2. Choose the subscription and resource group. Switch Microsoft directories first if necessary. Select an existing resource group, or name a new one and choose its region. Select the email data location.
  3. Save configuration. MemQL verifies access to the enabled subscription and an existing selected group, then saves the authorization encrypted in this cluster. Saving creates no Azure services and sends no mail. A new group is created only when you later confirm a domain's resource plan.

All replicas use the same saved configuration and coordinate refresh-token rotation in PostgreSQL. The private browser sign-in session is bound to its initiating MemQL user and expires after one hour once authorized; the saved cluster authorization remains available after it expires. Only the opaque session identifier is kept by the browser. Access tokens, refresh tokens, and sending keys never appear in browser responses. Microsoft can revoke the saved authorization or require another sign-in under its directory policy. Existing verified sends can continue with their sending keys when management sign-in needs renewal; domain changes require renewed authorization.

Disconnect in cluster email settings stops Azure sends and domain setup for every organization. Reconnect before choosing a different subscription or resource configuration. Reconnecting to the same configuration can resume its existing domains. Changing it requires reconfiguring each domain; the cluster never silently reuses credentials from a different configuration. Disconnect does not delete Azure resources, revoke keys in Azure, alter DNS, or stop Azure billing. Historical encrypted versions follow the installation's retention policy. Already submitted messages cannot be recalled.

Add each client's domain and sender

In Email → Settings, Email → Settings → Sending domain, or Settings → Connections → Email, select the client organization. An owner or developer also needs write access to that organization. Other campaign authors use its saved sending identities.

  1. Add sending domain. Enter the client's domain. Resource names are suggested and can be changed. Subscription, group, and email data location come from the cluster configuration; no client Microsoft sign-in is needed.
  2. Review, then create. MemQL registers the Communication resource provider if needed and creates the email service, delivery service, and custom-domain resource. Usage is billed to the operator's selected Azure subscription. MemQL does not convert the subscription, buy support, or send mail during setup. Interrupted steps check the same resources. Resource ownership tags bind services to this cluster configuration and organization; unrelated resources are refused. Names are reserved across replicas before creation and remain assigned after disconnecting. A changed plan must be reviewed again before resources are created. After confirmation, the open wizard continues the setup automatically and advances to domain verification when Azure is ready. Preparing email shows the elapsed wait. Leaving preserves the approved plan; reopening resumes it. An Azure error or an extended wait pauses automatic checks and offers Continue setup for the same resources.
  3. Verify domain. Add the exact TXT/CNAME records Microsoft supplies at the domain's DNS provider, then choose Check domain records. Each record uses the same Type, Name, and Value layout as Deployables domain binding; click a name or value to copy it, and read its verification state below. Completed wizard steps remain available to review. Merge an SPF include into an existing SPF record rather than creating a second one. Preserve existing MX and website records. Domain, SPF, and both DKIM checks must succeed. The plan is saved, so you can return after DNS propagates without another Microsoft sign-in.
  4. Save sender. Sender news on client.com sends as news@client.com. Set the client's display name and an existing reply mailbox such as help@client.com. ACS sends outbound mail; it does not create receiving mailboxes. no-reply is optional. The verified sender appears in Email.

A client send requires that organization's ready transport and verified sender. It never falls back to the operator's Graph/SMTP mailbox. ACS sets the display name on the sender resource; a campaign override that differs is refused. Disconnect domain stops only that organization's future sends, preserving other organizations and the cluster's Azure authorization.

A successful ACS submission means accepted by Azure, not delivered to an inbox. Ambiguous submission responses are not automatically resubmitted. Once the instance's public API is reachable, background maintenance installs an authenticated Event Grid subscription for each ready organization. Existing connections and imported packages are discovered automatically. Check sends reports feedback setup as pending or ready; pending setup leaves sending available and retries without creating another subscription.

Registration and installation setup

MemQL ships the public application ID of MemQL Azure Connection, its multi-tenant Microsoft Entra application. This identifies the software; it is not a secret, subscription, or authorization. Register the application once for MemQL. Operators do not register another app or supply its ID in environment variables for each client or installation. The same registration supports local and cloud installations in commercial Azure.

Each installation keeps its own authorization and sending credentials. A local connection is never copied into a cloud cluster or another client's installation. The same operator may configure separate clusters against its own directory and subscription. A client's directory consent is relevant only if the operator chooses to use Azure resources controlled by that client. Consent cannot give the signed-in user Azure permissions they do not already hold.

The device code flow uses the existing MemQL stream. It adds no OAuth callback endpoint or per-installation redirect URL. Local capture works without Azure; connecting Microsoft does not switch test emails to external delivery.

Azure installation prepares email before first sign-in. Both installInstance and bringUpInstance inspect the selected AKS cluster and establish email authorization before ArgoCD starts the engine. No additional email options are required for an ordinary first install. The resource group includes the full fingerprint of the cluster's physical OIDC issuer; recreated or concurrently installed clusters therefore cannot acquire the same email group through a name collision. Service names are deterministic and bounded.

The email resource group's region defaults to the cluster's region. Email data residency defaults to Azure's reported cluster geography, with US mapped to United States. An unsupported geography requires an explicit emailDataLocation; the installer never silently chooses a different geography. The optional emailResourceGroup is a prefix (at most 25 characters), to which the physical issuer fingerprint is appended. emailIdentityName, emailService, communicationService, emailLocation, emailDataLocation and emailReplyTo can override the first-install choices. Repeat installs preserve saved choices; a conflicting explicit choice is refused for review. Existing sender connections remain unchanged by this authorization step.

Inspection is read-only and can also be run directly:

shell
scripts/deploy/inspect-azure-email.sh \
--subscriptionId=00000000-0000-0000-0000-000000000000 \
--resourceGroup=example-cluster --clusterName=example --namespace=memql

The install's authorization step uses the operator's signed-in Azure account. That account must be able to create the dedicated email resource group and managed identity, register Microsoft.Communication and Microsoft.EventGrid, and assign a role on the new group. The cluster itself receives Contributor on that email group only, through its own managed identity and federated service-account assertions. Its email group must differ from the cluster resource group. A group or identity bound to another cluster's OIDC issuer is refused, including a recreated cluster with a different issuer.

Only public identifiers and resource choices enter the memql-email-installation ConfigMap as MEMQL_EMAIL_INSTALLATION. Each engine replica exchanges its projected assertion for a short-lived management token; operator CLI credentials and refresh tokens are never copied into the cluster. Sending credentials and setup progress use the existing encrypted shared store. A repeat install preserves the same identity and choices; it refuses a different configuration instead of replacing a live connection.

Engine startup runs the installed emailInstallationWorkflow: establish the cluster connection, ensure the ordinary operator organization exists, prepare the named resources, and enable the sender after Azure confirms them. The initial sender is Azure's default donotreply@…azurecomm.net with Azure's existing display name, so first sign-in does not depend on custom-domain DNS. Azure-managed domains have limited sending volume and do not support personalized sender usernames; configure a custom domain in Settings for branded or higher-volume mail. This cluster-bound bootstrap domain is not exported as a portable organization package. See Microsoft's Azure-managed domain guide and domain comparison.

Azure creates can remain pending. A fresh node reports that email setup is not ready and resumes from the saved plan on restart; it does not claim readiness with a logging-only sender. A working Graph/SMTP transport remains available while setup progresses, and maintenance continues the same bounded workflow after startup. Completion uses the same sender identity and readiness checks as Settings. A later disconnect or a connection explicitly chosen in Settings is preserved across restarts. Operator-managed client domains use this installation's saved Azure authority, with their own organization-scoped resources and sending credentials. Local capture stays capture; it does not use an Azure identity or require public OIDC federation.

Microsoft directory policy can require administrator approval. Publisher verification is separate from verifying a publisher domain. The registration's publisher verification must be completed before relying on broad customer self-service consent. This does not require a separate registration for each operator-managed client. See Microsoft's application and service principal model and publisher verification requirements.

Protocol references: device authorization flow, email domain setup, email sending API.

Storefront newsletter signups

In Email → Audiences, open the client's audience and choose Signup forms → Connect a signup form. Select its deployable. A published welcome template is optional for an audience that does not require confirmation; leave it empty when an automation sends the welcome. Select the client's sender when a welcome template is chosen. Write the sentence the visitor will agree to, then enable the connection. All resources must belong to the same organization. An audience is a marketing list, not a group granting access to MemQL.

Get form → Copy form provides plain HTML to add to the storefront in VS Code. Include /newsletter/thank-you and /newsletter/problem pages in that site's bundle. A form posts to /_memql/forms/campaigns/subscribe on the deployable's own origin. It carries the email, optional name, affirmative consent checkbox, and saved consent revision. Replace the copied form after changing the connection; an old revision is refused rather than recording consent to new wording. This does not subscribe an arbitrary externally hosted Shopify site: the storefront must be a MemQL deployable with the public-form carrier available.

Enabling the connection also enables that deployable's public forms. Turning the newsletter off stops enrollment and blocks pending welcomes; it leaves other declared forms alone. Current organization write authority and access to the deployable are required. A draft or archived welcome and a disabled sender may remain selected while turning an existing connection off.

The server derives the organization, audience, sender and live store binding. Form fields cannot override them. Storefront previews with a different store binding are refused. An audience chooses No confirmation or Require confirmation. With no confirmation, an affirmative signup records consent and enrolls a subscribed recipient. With confirmation required, the recipient is pending: no consent grant or welcome is sent until the person confirms. Connect an active joined automation whose first step asks for confirmation; the connection has no separate welcome template. Imports and row-address rules also respect the audience's confirmation setting. Ordinary campaign sends and email rules never mail a pending member.

Unsubscribed, bounced, complained-about or suppressed addresses are not silently resubscribed. After a confirmation run has expired, a new affirmative form submission can start a fresh pending membership and confirmation. A retry of the original submission cannot do so. Renewed membership changes joinedAt; its automation enrollment and send receipts are distinct from the earlier run.

Repeated submissions converge on one signup and one intended welcome per normalized address and audience, even across deployables and worker replicas. An address already in the audience is found by its digest, the SHA-256 of the trimmed, lower-cased address, which the engine puts on each recipient it adds, instead of by reading the whole audience. A recipient written before the digest existed has none until the digest sweep reaches it, so the rows without a digest are checked by their address as well. Any row for the mailbox that has unsubscribed, bounced or complained keeps the form from enrolling it again or sending it a welcome, including a row opted out by hand and a row beside a duplicate for the same mailbox. The lookup is not an index read: the cost of each signup grows with the number of recipients in the cluster.

The digest lookup returns at most 50 memberships. If it fills that page, the signup and row-address email rule refuse to proceed: an opted-out duplicate could be beyond the page. No consent, enrollment or send follows that incomplete answer. Consolidate duplicate memberships while preserving any opt-out before retrying; the digest sweep does not remove duplicates.

Rolling out the digest. The digest is put on existing recipients by a sweep in the campaigns worker, not by a migration. A recipient record refuses a field it does not declare, so a replica still running the previous release cannot update a recipient that carries a digest: an unsubscribe it receives answers the retry page, a bounce or complaint it handles cannot be applied to the recipient, and a by-hand change through it errors, until that replica is gone. A migration would run before the new replicas start and stamp every recipient while the previous release is still serving, so the sweep runs ten minutes after each node starts and hourly after that, when a rollout is normally over. It runs whether or not campaign sending is enabled on the node (MEMQL_CAMPAIGNS_ENABLED), because signups and email rules write recipients either way. The ten minutes is a guess, not a check: a rollout that outlasts it is swept while an old replica still serves, and the recipients that pass reaches cannot be updated by that replica until it is gone. New recipients carry the digest from the first request of the new release, and rolling back to a release before the digest leaves them in the same state, so roll forward instead. Replicas sweep side by side without waiting for each other: a pass that finds a batch's lock taken skips the batch, tries it once more at its end, and leaves what is still held for the next pass.

Until the sweep has been through, a signup always reads one page of the audience's recipients that have no digest as well, and once it has that page is empty. While an audience holds a full page of them (50), which is every audience of 50 or more recipients between a rollout and the first sweep, the signup reads the audience page by page (500 recipients a page, about two seconds a page with 200,000 recipients in the cluster) and stops at the first row for the address that opted out. That is the cost the digest removed, so it stops after ten pages: in an audience of more than 5,000 recipients it does not start (the audience's size says it cannot rule an opt-out out), and the form asks the visitor to try again later at once. An email rule that sends to an address on a row has no such read, and declines to fire and says so in its refusals. The sweep logs "put the address digest on recipients written without one" with a count when it stamps anything; a pass over recipients that all carry a digest writes nothing.

What a signup holds. A signup serialises its writes with two advisory locks, the storefront's and then the audience's, taken together in one transaction on one connection of the pod's write-gate pool: connections used for nothing else (MEMQL_DB_GATE_POOL_SIZE, four by default), so the work under the locks keeps all of the request pool, and the locks are not subject to the request pool's 60-second limit on a session idle in a transaction. A gate session may sit idle for five minutes (MEMQL_DB_GATE_IDLE_IN_TX_TIMEOUT_MS), and a signup stays far inside that.

Uncontended, which is the usual case: the locks are taken at once. Everything slow is read before them (the form, the mailbox and the audience's size above, the welcome template), so a slow read delays only that visitor. Under the locks the signup checks again only what must be exact when it writes: the storefront's binding, the signup row, the suppression list and, for a mailbox it is about to add, the audience's room and the mailbox by digest, so signups that ran side by side cannot together pass the audience's ceiling or add the same person twice. Immediately before each write it asks its gate whether the locks are still held. The single-row reads and the writes are milliseconds. The two reads for a new mailbox are not: the engine answers any recipient read from every current recipient in the cluster, which costs one to four seconds each at 200,000 recipients, depending on how busy the database is. A new subscriber at that size holds the locks for about two of them, and about twenty seconds in all.

Contended: new subscribers to one audience take their turns. A signup that has waited six seconds for its locks, or for a connection of the gate pool, answers "Too many signups at once. Try again in a moment." and writes nothing; at 200,000 recipients that is more than a couple of new subscribers to one audience at the same moment. A signup that gets its locks but is under them for more than thirty seconds starts no further write and gives the same answer; a write already under way when its time runs out, or when the visitor leaves, is waited for (up to ten seconds, past the database's own eight-second limit on a statement) and commits while the locks are still held. Ten seconds is a wait, not a cancel: the database driver sends the server no cancellation, so a write still running when the wait ends (it takes more than one statement, or a stalled network, to outlast the database's own limit) is given up on, the locks are given back, and the server may still commit it afterwards, beside whichever signup has taken the locks since. Consent is written first and keyed by the signup, so asking again is safe at every step. If PostgreSQL ends the gate's session (an administrator, a failover) the signup finds out before its next write and makes none. A pod whose gate connections are all held (four signups, welcomes or other gates at the same moment) makes the next signup wait for one, up to the same six seconds, and then give the same answer.

For audiences without confirmation, consent is stored before a new recipient becomes sendable. The accepted record captures the storefront, original mailbox, consent wording and revision, and published welcome content. Editing the template later does not rewrite that welcome. Changing the recipient's mailbox blocks the queued welcome instead of redirecting it to an address that did not consent. Current authority, sender availability and suppression are checked again before sending.

A welcome takes the storefront's lock, the audience's and its own send receipt's together, in that order, in one transaction on one connection. It holds them for at most the send's timeout plus thirty seconds for its reads (two minutes at most), and a send that began can hold them past that for up to twenty seconds: an attempt receipt begun at the phase boundary can take ten seconds, followed by up to ten seconds to write the welcome's outcome. The receipt that says an attempt began and the outcome are written only if the locks are still held, and a write begun is waited for rather than cut; the one exception is the ten-second wait described under signups, which a write can outlast without the server ending it. A lock that is busy at any point before the send begins, including the email provider's own (Azure's send receipt), is "nothing attempted, try later": the welcome stays pending, nothing is marked blocked, and the next worker pass sends it. So is a welcome whose time under its locks runs out, or whose worker stops, before its send begins, one whose storefront could not be read, and one whose send hit a database error before it began, reading the template, the recipient, the sender or the do-not-mail list, or recording that an attempt began: only a send that began ends a welcome, and its outcome is recorded even when the send outlasts the welcome's time. A welcome is marked blocked only for a reason of its own (the newsletter or its storefront was turned off, the saved copy of the reviewed template cannot be read, the send was refused, for instance because the recipient's address changed or the sender was retired).

Recent welcomes shows the latest 50 outcomes, read when the audience opens and updates on its own. A rate limit or a busy lock leaves mail pending for a later worker pass. A blocked welcome shows its reason; after resolving it, Check again rechecks that exact saved outcome. An attempt with a lost provider response is uncertain and is never automatically submitted again. sent means the transport accepted the message, not proof of inbox delivery. Local capture sends appear in the Email inbox.

This uses the existing declared shopper-form carrier, its size and rate limits, and borrowed site-owner authority. Campaigns is core and declares the campaigns/subscribe form itself; installing a pack is not required. Enrollment and welcome progress use shared PostgreSQL locks, fresh reads, stable IDs and monotonic revisions. Private mutations cannot be called or forged by clients. Newsletter configuration changes broadcast to other replicas; high-volume signup outcomes update automatically while the audience is open. Configuration uses campaignConfigureNewsletter; rechecking uses campaignRetryNewsletterWelcome, both with saved revisions.

Use the same audience in multiple campaigns, with independent templates and schedules. The automatic welcome is separate from those campaigns.

Email automations

An automation starts when someone joins an audience or confirms their membership. Build a sequence of Send email, Wait and Ask for confirmation steps. It holds 1–20 steps and at least one email. A wait lasts one hour to 365 days. Confirmation waits 1–30 days (seven by default), uses a published template containing {{confirmUrl}}, and may appear once. A joined automation for an audience requiring confirmation starts with that step; a confirmed trigger does not ask for confirmation again. Every audience, template and sender must belong to the automation's organization.

Save a draft and resolve its card-level issues before turning it on. Changes require the saved revision; an active automation is paused before editing. Describe turns a short description into an editable draft using the organization's existing catalog. Missing resources remain explicit issues. Describing saves nothing and turns nothing on.

The campaign drain enrolls members joining or confirming after activation, then advances due steps. It borrows the recorded owner's current authority, uses fresh reads and coordinates across replicas with shared locks. Each membership is identified by its recipient and joinedAt; each email step has a stable receipt, so another replica cannot submit it again. A changed address, renewed membership, opt-out or suppression exits an old enrollment. Three conclusive preflight failures mark it failed and expose the reason. Busy locks, rate limits and uncertain reads wait without consuming those attempts.

Pausing stops advancement and keeps progress. Archiving retires open enrollments. A confirmation timeout exits with “not confirmed.” A valid late confirmation reopens that same enrollment after its confirmation step while the automation is active. A separate renewed opt-in creates a new membership instead.

The recipient pages are token-authenticated HTTP exceptions approved on 2026-10-11. They need no MemQL sign-in and use the configured public API origin:

PageBehavior
/email/confirmGET displays the choice; POST records confirmation and consent, then wakes the matching journey.
/email/preferencesGET displays current choices; POST changes the subscription. Unsubscribing applies organization-wide suppression. Resubscribing may lift only an unsubscribe suppression; bounce and complaint suppression remain.
/email/viewGET renders the exact sent template revision without tracking. If it is unavailable, the page says so.

Opening a confirmation or preferences link never changes a subscription. Confirm links expire after 30 days; expired links record nothing. Preferences and view links have no time expiry, but still validate current organization and recipient identity. Tokens are purpose-bound and encrypted with AES-256-GCM, using the unsubscribe signing key and its previous-key ring. Key rotation keeps links valid while their key remains in that ring. Forwarding a link gives its holder that link's authority, so treat recipient links as private.

The one-click unsubscribe endpoint retains its existing RFC 8058 behavior. Confirmation, preferences and unsubscribe share mailbox coordination so concurrent choices cannot clear an opt-out in another audience accidentally.

Repeating campaigns

Open a campaign and choose Repeat → Set up repeating sends. Select the first send and a weekly interval, such as every two or three weeks. The timezone is shown beside the date. Cadence follows its local calendar time across daylight saving changes. A recurring schedule can be created before its audience has subscribers; an empty occurrence completes without sending mail.

The original campaign is a blueprint. Saving the schedule captures its audience, sender, organization and tracking settings. Save the schedule again after editing those campaign details. Each occurrence reads the then-published template and freezes that copy in a separate campaign/send job. Later edits cannot change an already queued occurrence. The audience is resolved when that occurrence runs, and consent and suppression are checked before delivery.

Each occurrence appears in Email with its scheduled date in the name and its own delivery history. The original draft can still be sent as a one-off; that is an additional campaign, independent of its repeating schedule.

Pause future sends stops new occurrences. Already queued occurrences keep their own pause/cancel controls. Resume future sends skips missed dates. After an unexpected outage, an active schedule queues at most one overdue occurrence, then advances to its next future date, preventing a burst of missed newsletters. A configuration or authority refusal blocks the schedule with a visible reason; review and resume it after resolving the problem.

campaignConfigureSeries accepts a campaign ID, save, pause or resume, and the exact saved series revision for changes. Saving also takes intervalWeeks (1–52), firstSendAt and an IANA timeZone. The cluster captures its definition from the readable campaign, never caller-supplied organization, audience or sender overrides. The person authorizing it must retain current organization write access. Shared PostgreSQL coordination, fresh reads and stable occurrence IDs make retries across replicas converge on the same job, including a crash after queueing but before advancing the schedule. A finished occurrence's job and delivery records are never reset.

Retrying event emails

Email rules supply a stable identifier automatically for each event and recipient. Their firing reports count suppressed and replayed sends as skipped, rate-limited sends as deferred, and uncertain outcomes as refusals. Audience rules follow every recipient page up to the 200-recipient firing limit. A missing or repeated continuation is an error, never a claim that the audience ended.

A rate-limited single send with a request identifier records a pending delivery and becomes due after one minute. The campaign drain retries it with the same owner and receipt, rechecking authority, subscription, suppression, template publication and sender readiness. A busy gate or undecidable read leaves it pending. A conclusive pre-send refusal records a failure; a provider outcome that is uncertain is never submitted again.

Rules aimed at cluster roles use the operational outbox. They require a published template and render its HTML and plain text for the current cluster recipient. This lane carries no marketing footer, tracking or recipient links; it does not permit an arbitrary external address.

An email rule fires once, on the replica where its triggering write happened, and the limits its runs draw on (10 concurrent runs and the automation execution budget) are counted per replica, so the cluster-wide ceiling is those limits times the number of replicas. A rule fires once per event: two identical updates to the same row within about an hour count as one, on a single node too. Each replica counts failures on its own, so a failing rule can fail up to five times on each replica before it stops everywhere.

Other automations that call campaignSendToRecipient should supply a stable requestId for each intended message, such as one signup event's welcome. Keep that identifier unchanged when retrying the same event. The recipient, template, rule and sender must also remain unchanged; reusing the identifier with different inputs is refused. The template must be published before sending.

The cluster records an attempt before contacting the provider. A retry on any replica returns the saved result without submitting another message. If the provider response was lost, or the process stopped after the attempt began, the retry returns uncertain: true and does not resend. Inspect the provider and delivery records before deciding whether another message is warranted. This prevents duplicate submissions; it does not guarantee mailbox delivery. Requests that omit requestId retain the existing per-invocation behavior.

Each request has its own delivery row. A send made with a requestId is recorded on a delivery row keyed by that request and the recipient, and the row names the request, the template and the sender (requestId, templateId, senderIdentityId) beside the outcome. A welcome, a journey step and a rule's send to the same person are three independently inspectable rows. A retry of the same request writes a new version of its own row. A send made without a requestId keeps the row it always had, one per rule and recipient (or per recipient when no rule is behind it), and still overwrites its earlier record. A campaign's deliveries are unchanged: one row per campaign and recipient.

Suppression and preflight refusals make no external send attempt and remain retryable, and so does a send whose coordination lock was busy: the attempt is recorded only after every lock the send needs has been taken, including the email provider's, so a busy lock leaves no record that an attempt began and the same request, made again, goes out. It is recorded only while the send still holds its own lock: if PostgreSQL ended the session that holds it, the send records nothing, contacts nothing and answers that its lock was lost, and the same request, made again, goes out. A database error while a send reads what it needs, or while it records the attempt, leaves it undecided in the same way: nothing was attempted, and a welcome stays pending instead of being marked blocked. An email rule that finds the lock busy tries again within its firing after one, two and four seconds. If it is still busy it reports a refusal ("nothing was sent to this recipient; the firing can be made again"), stops an audience rule at that recipient, and for a rule that fires when a row is created gives the row's claim back, so the event delivered again fires for it. The bulk send treats a busy lock as a wait: the delivery keeps its attempt count and the campaign pauses for fifteen seconds. Receipt reads still require current send authority in the recorded organization. The internal receipt cannot be forged through client mutations.

Local test inbox

The local k3d overlay selects the capture email transport automatically. Open Email → Inbox in MemQL OS as an owner or developer to inspect messages generated by sign-in, invitations, campaigns and email rules. Messages are stored in the installation's shared storage, encrypted with its existing master key; capturing on one node and reading on another works without a separate mail server.

The inbox shows the latest 100 messages from the past seven days and updates on its own after triggering mail, or return focus to the app. Open a message to inspect its sender, recipient and body, and follow its verification link. Previews remove scripts, remote images and styles, so opening test mail does not load tracking pixels. Older encrypted rows are not deleted by the inbox's seven-day display window.

Capture sends no Internet mail, even when external provider credentials exist. It is selected by the installation value MEMQL_EMAIL_TRANSPORT=capture, never by a person's role or an email address. Storage or encryption failures fail the send instead of claiming success. The ordinary external transport remains auto; its Email app states that receiving has not been connected. Neither mode changes bootstrap's email-validation exception or connects Outlook.

This is an operator test inbox and can contain other test users' sign-in links. Ordinary users and admins cannot read it. It is not a connected personal mailbox.

The shape of a send

text
operator engine recipient
──────── ────── ─────────
campaignStartSend ──▶ preflight (sender? unsubscribe?
campaignScheduleSend template ready? audience sane?)
│ refuses here, or
▼
v1:campaigns:sendJob
(queued — or `scheduled`, which
the worker promotes to queued
once the campaign's scheduledAt
has passed)
│
drain worker ──────▶│ every 15s, one batch per job
│
├── roster page ⨯ its ledger = who is left
├── cluster suppression list = who may not
├── token bucket = how fast
└── send ─────────────────────────────────▶ inbox
│ │
v1:campaigns:delivery (one row per │
recipient, terminal) │
│
suppression list ◀── POST /unsubscribe ◀── one-click ◀────────────────┘

Configuration

Minimum to send anything:

VariableWhy
MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRETSigns the one-click unsubscribe link. Required — a send is refused without it. Rotating it needs the variable below; see Rotating the unsubscribe signing key.
MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET_PREVIOUSThe previous signing key: verified against, never signed with. Optional, and unset only on a deployment that has never rotated.
MEMQL_CAMPAIGNS_UNSUBSCRIBE_BASE_URLPublic origin the link points at, e.g. https://api.example.com. Required. Must be externally reachable: the recipient's mail client POSTs to it. It is also the origin the open pixel and click redirects are built from — tracking introduces no second variable, because two origins that can disagree is two ways for a message to carry a URL nothing serves.
An email senderA ready Azure connection and verified sender for the campaign organization. Explicit local capture is also supported. Graph/SMTP remain available for the operator organization; a client campaign cannot borrow them.

Tuning (all optional, all documented in env-vars.md): MEMQL_CAMPAIGNS_SEND_RATE_PER_MINUTE, _BATCH_SIZE, _MAX_ATTEMPTS, _MAX_AUDIENCE, _POLL_SECONDS, _STARTUP_DELAY_SECONDS, _CLAIM_TTL_SECONDS, _THROTTLE_SECONDS, _SEND_TIMEOUT_SECONDS, _ENABLED.

Feedback and warming (both opt-in, both off with no value): MEMQL_CAMPAIGNS_FEEDBACK_SOURCES (feeding bounces back in), _WARMUP_ENABLED and the _WARMUP_* ladder and thresholds (warming), _SENDING_IDENTITY.

On a Microsoft Graph deployment there is one more, and without it the suppression list quietly starves on the transport you actually send on: MEMQL_EMAIL_NDR_POLL_SECONDS (default 300; 0 disables) runs the Graph mailbox reader, and the rows it stages mean nothing until graph-mailbox=rfc3464 is listed in MEMQL_CAMPAIGNS_FEEDBACK_SOURCES.

Rotating the unsubscribe signing key is a two-variable operation, and doing it with one variable breaks every link already sent. The procedure is below.


The decisions

A campaign is one operator's, and the cluster owner can see it

The nine operator-facing concepts — audience, recipient, template, senderIdentity, campaign, delivery, consentEvent, engagementEvent and emailRule — carry the composite tier, @rowAuthz(owner="ownerUserId", clusterOwner). Every row's ownerUserId is stamped from the caller's own actor rather than from an argument, so a campaign belongs to whoever made it.

What the second term buys, and what it deliberately does not. A cluster owner READS every operator's campaigns, and can drive the builtins on them — campaignStartSend, campaignPauseSend, campaignResumeSend, campaignScheduleSend, campaignStats, campaignTestSend — because each of those is gated on "can the caller read the campaign row" and nothing else. A cluster owner cannot rewrite another operator's campaign directly: the write guard ignores the second argument, so updateCampaign, createTemplate and every other row write stays owner-scoped.

That asymmetry is the point. The person who has to answer "why did this client's send stop" needs to see the row and to be able to stop it; nobody needs to be able to edit somebody else's copy behind their back. Without the second term the oversight would not merely be unimplemented — a plain owner tier has no cluster-owner escape on the READ path at all, so it would not be expressible, and every fleet-wide campaigns view would silently render one person's subset while looking complete.

Full team sharing — several people editing one campaign — is a deliberate non-goal. This is oversight, not sharing.

The four engine concepts (sendJob, suppression, reputationWindow, warmupState) stay clusterOwner-tier and are not readable by an ordinary operator at all.

Client opt-outs belong to the organization

An unsubscribe blocks marketing mail from the organization that sent it, across that organization's audiences, campaigns, and sending identities. It does not remove the same address from an unrelated client's list. Both queued campaigns and event-triggered sends check this at send time, even if a CSV import has recreated a subscribed membership.

The engine-owned v1:campaigns:suppression rows store an organization ID and an email digest, never a plaintext mailbox. The composite row ID includes both, preventing clients from overwriting each other's opt-outs. Reads bypass per-node caches so a click handled by one replica is visible to another sender.

Existing rows without an organization remain cluster-wide safety blocks. They are not silently narrowed or removed. campaignSuppress and provider hard-bounce/complaint feedback continue to create these administrator-level blocks. A matching block in either scope prevents delivery.

Suppression is enforced at the point of send

Not at audience-build time. The worker checks both suppression scopes for every recipient immediately before mailing, before it looks at the recipient row's own subscriptionStatus. That ordering is what "outranks every audience" means: a re-imported CSV produces a recipient row saying subscribed, and the applicable suppression still refuses it. An audience assembled last month cannot know about last week's unsubscribe.

A suppressed recipient gets a skipped delivery row with the reason, not a silence — the operator is owed the outcome.

If the suppression lookup fails, the batch stops. An unanswerable list is never read as an empty one.

A hard bounce suppresses; it does not delete the membership

campaignRecordFeedback(kind: "hard_bounce") adds the address to the cluster list and the next send marks that operator's recipient row bounced. The audience membership stays.

Deleting it looks tidier and is wrong twice. It destroys the audit trail — an operator whose delivery rate fell finds a smaller audience and no explanation. And it makes the address resurrectable: the next import re-adds it as a fresh subscribed row, and mailing a known-dead address is exactly what a reputation system punishes. Keeping the row makes the sendable count drop visibly with the reason attached; keeping the cluster suppression means a re-import cannot undo it, because the list is consulted at send time rather than at import time.

A soft bounce does neither. It is transient — a full mailbox, a greylisting relay — and suppressing on one loses a real subscriber to a bad afternoon. The per-recipient retry budget (MEMQL_CAMPAIGNS_MAX_ATTEMPTS) is what bounds those.

The audience is walked, not held

The send reads the roster one page at a time, through the engine's keyset cursor, and reads the delivery ledger for that page rather than for the campaign. Both halves matter: the ledger for a large campaign is exactly as large as its roster, so cursoring one and not the other would move the ceiling rather than remove it.

Before this, both reads were whole and bounded at 5000 rows — and a bounded read of an unbounded set is a truncation, so a larger audience would have been mailed as a silent prefix. The send refused instead, and "5000 is the largest mailing list this can send to" was the price.

Why ascending order is safe while the roster is being edited. Reads collapse to the latest version per id, so editing a recipient mid-send — which this worker does, converging a suppressed address — moves it to a newer timestamp, i.e. forward in an ascending walk, never backward past the cursor. A row can therefore be seen twice and can never be missed. A duplicate costs a comparison; a skip costs somebody their mail. Duplicates inside one batch are de-duplicated, because those would be mailed before either send was recorded.

The cursor is an optimization, not the idempotency mechanism. It lives on the send job so a tick resumes instead of re-scanning from the start. Losing it, or having the engine refuse a stale one, costs one re-scan. What decides who gets mailed is the ledger, below.

MEMQL_CAMPAIGNS_MAX_AUDIENCE still exists, and now means something different. It was a correctness guard at 5000. It is now a deliberate refusal at 250,000: no size is unsafe, but a send that large is more often a mis-scoped audience or a bad import than an intent, and it cannot be recalled. Raising it is a decision about how large a send you mean to make — not something you have to do in three places to avoid silent truncation.

Idempotency is the ledger, not a retry flag

v1:campaigns:delivery has one row per (campaign, recipient), at a deterministically derived id. (A single send outside a campaign has one per (request, recipient); see Retrying event emails.) The worker's batch is "roster members with no delivery row, plus rows still pending whose retry is due". A recipient that reached sent, skipped or terminal failed is simply not in the next batch.

So a resumed send, a restarted process, a paused-and-resumed campaign and a claim lost to a dead replica all converge on the same behaviour, and none of them needs anything to remember what it did. The absence of the row is the work queue.

Cross-replica, a Postgres claim (campaignSend, keyed per job and progress count, leased for MEMQL_CAMPAIGNS_CLAIM_TTL_SECONDS) means one replica drains a given campaign at a time.

Two rate limits, and both are needed

Ours is a token bucket, MEMQL_CAMPAIGNS_SEND_RATE_PER_MINUTE, per process. It exists so the provider's limit is not discovered by exceeding it on every send. Per-process rather than cluster-wide is correct for what it defends: only one replica drains a given campaign, so a campaign is paced by exactly one bucket.

Theirs is the 429. Microsoft Graph throttles a mailbox and answers 429 with a Retry-After; the sender surfaces that as a typed error, and the worker parks the whole job until the stated deadline and ends the batch. A 429 with no Retry-After is still a throttle and parks for MEMQL_CAMPAIGNS_THROTTLE_SECONDS.

Ignoring the second is the failure the issue names: the loop keeps hammering, the provider keeps refusing, and the retries eventually arrive as duplicates in the recipient's mailbox.

Every campaign message carries both halves:

text
List-Unsubscribe: <https://api.example.com/unsubscribe?token=...>
List-Unsubscribe-Post: List-Unsubscribe=One-Click

and a link in the body. The header serves the mailbox provider's own "unsubscribe" button; the link serves a person reading in a client that does not surface it.

GET /unsubscribe renders a confirmation page. POST /unsubscribe performs the opt-out. A GET never unsubscribes anyone — mail clients, link scanners and security appliances prefetch URLs found in messages, which is precisely why RFC 8058 specifies a POST.

New tokens bind owner, recipient, campaign, organization, and the original normalized email digest with an HMAC. Moving, renaming, or deleting a recipient cannot redirect the opt-out. Already-mailed u2 links remain valid and derive the organization from the recipient they originally named. An authoritative suppression-write failure returns a retryable 503, never a success page.

The token is not stored: storing one would mean a row per recipient per campaign, minted at send time and never prunable, because a link in somebody's inbox has to keep working for years. It does not expire, for the same reason — a stale unsubscribe link is a compliance failure dressed as hygiene.

The endpoint is HTTP, which is a documented exception to the gRPC-first rule for the same reason POST /inbound/{source} is: the caller is the recipient's mail client, and there is no gRPC version of that conversation.

Confirmation, preferences, and viewing an email

Email templates can use {{confirmUrl}}, {{preferencesUrl}}, and {{viewUrl}}. The confirmation link is present only in a confirmation message. Each opens a small recipient page on the same origin as the unsubscribe link. These three HTTP exceptions were owner-approved on 2026-10-11: a recipient's browser follows an ordinary email link and cannot speak the MemQL stream protocol.

PageWhat it does
GET /email/confirmShows whether confirmation is still needed.
POST /email/confirmRecords consent, confirms a pending subscription, and wakes waiting automations.
GET /email/preferencesShows the subscription and its available choices.
POST /email/preferencesUnsubscribes, confirms a pending subscription, or subscribes again after an organization opt-out.
GET /email/viewRenders the exact saved template revision used for the message, without tracking.

GET never changes consent, so email scanners cannot confirm or unsubscribe someone. Forms use POST. A bounce, complaint, or cluster-wide suppression cannot be undone from preferences. Subscribing again lifts only that organization's opt-out; a later unsubscribe blocks mail again. Confirmation, preference changes, and one-click opt-outs serialize across replicas and shared mailbox memberships.

Each page's token is encrypted and authenticated for that page alone. A view token cannot confirm a subscription. The recipient's current organization and mailbox must still match the token. A confirmation received after an automation's confirmation timeout resumes after that step only while the automation is active. It keeps the same enrollment and cannot revive an earlier audience membership. Subscribing again from preferences records a new membership for future enrollments. Retrying a confirmation is safe if the subscription was saved before its automation could resume. Confirmation links expire after 30 days; preferences and view links do not expire. A missing saved message returns an unavailable page. A failed write returns 503 with Retry-After: 30, so the person can safely retry the same link.

Rotating the unsubscribe signing key

The token names the key that signed it, and the node verifies against a ring of two — MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET and the optional MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET_PREVIOUS. Only the first ever signs.

text
u3.<keyId>.<owner>.<recipient>.<campaign>.<organization>.<emailDigest>.<tag>
^^^^^^^ first 4 bytes of HMAC-SHA256(secret, "memql/campaigns/unsubscribe/key-id"), hex

The key id is a digest of the key, not a slot number or a counter. That is deliberate: a link minted today is clicked on a node where that same secret has since become the previous one, so a label like "current" would be wrong exactly when it is needed, and a counter is one more value an operator can set inconsistently across replicas. A digest of the key is true wherever the key is. It leaks nothing — anyone holding a token already holds a 128-bit MAC over known plaintext under the same secret.

The procedure

  1. Set MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET_PREVIOUS to the current value of MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET.
  2. Set MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET to the new value.
  3. Apply both in the same change and roll every node that mints or serves unsubscribe links (the campaign worker and the bff).
  4. Leave _PREVIOUS set. Do not remove it later.

Step 4 is where this differs from every other key rotation in the system, and it is the whole reason this page has a section.

How long does an old link keep working? Forever — until a second rotation.

The window is counted in rotations, not in days. There is no time-based expiry anywhere in the token, and adding one would defeat the point.

The usual advice — "drop the previous value once no unsent mail references it" — has no true form here. An unsubscribe link does not expire when the send finishes; it lives in the recipient's mailbox for as long as they keep the message, which for a mailing list is indefinitely. So there is no date after which retiring the old key is safe, and _PREVIOUS is not a migration window that closes. It is a permanent second reader key.

What that buys, stated plainly:

Links signed by
Current keykeep working
Previous keykeep working
Any key retired by an earlier rotationdead, permanently

So the standing rule is rotate at most once for any reason short of compromise. A second rotation retires the oldest key and does break every link it signed — which is acceptable in exactly one case: the key leaked, and killing those links is the point. If a routine second rotation is unavoidable, treat the messages signed by the retiring key as messages whose opt-out is now mailto-only, and say so in the next send's footer.

What the engine tells you

  • At boot, the campaign worker warns once when this deployment holds only one key and has already sent campaign mail:

    text
    WARN campaigns: this cluster has already sent campaign mail and holds only ONE
    unsubscribe signing key. MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET_PREVIOUS is unset,
    so changing MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET would invalidate every
    unsubscribe link already sitting in a recipient's mailbox ...

    It is silent before the first send (setting _PREVIOUS then costs nothing) and silent once _PREVIOUS is set.

  • When a link arrives signed by a key nobody holds, the endpoint renders the ordinary "This link is not valid" page — never a 500 — and logs a warning carrying the token's keyId (which is not secret). One of those lines means a rotation dropped a key that had already signed live mail.

SPF / DKIM alignment is structural

MemQL does not sign DKIM — the relay does, with the keys published for the mailbox it authenticated as. What MemQL guarantees is that it never sets a From address the relay did not authenticate as:

  • the From address is never a free parameter of a send. It is either the configured sender credential's own mailbox, or the address of a sending identity an operator declared as a row — a closed registry, resolved server-side from the campaign, never a string the caller supplies;
  • v1:campaigns:campaign still has no from-address field. It has senderIdentityId, which names a row, and fromName, which is a display name only;
  • replyTo is per-campaign and is the correct escape valve: it steers replies without touching the authenticated identity.

Your side of it is DNS, and it is now per identity. Publish SPF and DKIM records covering every mailbox any identity sends as, plus a DMARC policy for each of those domains. Adding a sending identity for a client's domain without their DNS records is the one way to make deliverability worse by using this feature. There is no preflight for it, because any check the engine could run would be a guess about records it cannot see from inside the cluster.

Mail an order entitles

A third shape sits beside the outbox and the marketing lane: campaignSendOrderMessage, one message to the buyer of one order -- the review request a store sends some days after a purchase, for instance. The buyer is on no list, and asking only subscribers would be asking only the customers a store expects to be happy, so this route asks no subscription. What keeps it from being a way to mail strangers:

  • It takes an order, never an address. The buyer's address is read off the mirrored order (storeId + orderGid); no argument names a recipient. The recipient exists only for that send -- no recipient row is written, so the buyer lands on no list a campaign could reach.
  • Every lawful-mail property of the marketing lane is kept. The organization's suppression list is consulted at the point of send, the RFC 8058 pair is attached and its one-click unsubscribe suppresses the address for the organization, the organization's sender is resolved, and the outcome is ledgered once per requestId with the single send's durable receipt.
  • Trusted jobs only. A call without internal origin is refused before anything is read.

The template fills {{fields.<key>}} from the call's fields (the product, the link, its expiry), and needs the same review and publication as any other. A field may not choose where a template's link goes, so a template writes the store's own address and takes the link's parts in its query: https://shop.example.com/reviews/write?product={{fields.productHandle}}&t={{fields.reviewToken}}.

The send goes out as the senderIdentityId the call names, which must belong to the store's organization -- with one exception the caller asks for by name. When the call also says installationSender: true, an identity of the installation's own organization (the one whose id is self) may stand in for an organization with no mailbox of its own. Only the transport moves to the installation's connection: the store's organization keeps its suppression list, the unsubscribe the buyer gets and the ledger, and any other organization's identity is still refused. The reviews pack says it only for the sender a store's reviews settings name, which only the cluster's operators can set.

Campaigns do not use the transactional outbox

v1:platform:outboundRequest and its worker deliver transactional mail. Campaigns send directly instead, for three reasons:

  1. the campaign worker has to see the provider's 429 and Retry-After to pace itself; a queue drained by another worker turns that into an opaque retry;
  2. a terminal per-recipient outcome is the point of the delivery row, and an async seam leaves every row pending until somebody writes a reconciler;
  3. MEMQL_OUTBOUND_EMAIL_ALLOWLIST is a domain allowlist for transactional mail. A marketing audience is by definition arbitrary external domains, so routing campaigns through it would either refuse every send or force that allowlist wide open — weakening the egress control it exists to provide.

delivery.outboundRequestId stays on the schema for a future queued transport.


Sending identities

One deployment, several clients, several mailboxes. A sending identity (v1:campaigns:senderIdentity) is the operator's declaration that a mailbox exists in this tenant and that campaigns may send as it:

FieldNotes
addressthe verified address the organization sends as. Normalized lowercase, validated for RFC 5322 shape and header safety — a CR or LF here would be header injection into every message the identity sends. It is also the reputation and warmup key, so two spellings of one mailbox would split its ramp in half
fromNamethe From display name, e.g. Acme News. Required: a From with no phrase shows the raw mailbox to every recipient
replyTodefault Reply-To for campaigns that set none of their own. A campaign's own always wins
accountIdthe organization this sender belongs to; must match its campaign and transport
statusactive or disabled
notesoperator provenance. Never a credential

There is no secret material on the row, and that is the design. Azure credentials live in encrypted organization connection storage. The identity row records the address and presentation; the transport still requires that address to be in the organization's verified sender set. Graph/SMTP credentials remain installation configuration for the operator's own mail.

Resolution order, and why there is no fallback

text
campaign.senderIdentityId → the operator SAID which mailbox
(empty, operator org) → the operator organization’s configured default
(empty, client org) → refused: choose that client’s sending identity

That is the whole ladder. The engine never infers an identity from a campaign's accountId. The authoring UI prefills the picker from the selected account's identities, and prefill is UX while resolution is explicit — an engine that guessed would mail a client's list from a mailbox nobody chose, and would be right often enough that the wrong case went unnoticed.

Client campaigns require an explicit identity. Legacy campaigns belonging to the operator organization can use its configured default.

A missing or disabled identity is refused, never silently defaulted. Falling back to the cluster default would mail a client's audience from the wrong mailbox, under the wrong From, against the wrong SPF and DKIM records, and nothing would say so — the send would look completely successful. The refusal is classified the same way every other preflight refusal is:

What happenedKindWhat happens
the identity row is missing, or its status is disabledauthoringthe campaign goes failed with the reason on lastError; fix the campaign or re-enable the mailbox and start again
this node's sender is SMTP and the campaign names a non-default identityenvironmentthe send waits and retries each tick, reason stamped

The second is an environment refusal because SMTP AUTH binds to one mailbox: a node with the SMTP sender genuinely cannot send as anything else, and a node that can may be running elsewhere in the cluster. Failing the campaign for a deploy-shaped reason would make an operator re-author a schedule to recover from it. The preflight runs at both authoring time and fire time, so an identity disabled between the two is caught at the second.

disabled is how you retire a mailbox

Not deletion. Past campaigns name the row, and the reputation history is keyed on its address — derivedSendingIdentity resolves per send to the identity's normalized address, so reputationWindowsSince and warmupStateForIdentity break down per mailbox with no change on their side. They were built for plurality and simply start receiving it.

Organization opt-outs apply across that organization's sending identities. Cluster-wide safety blocks still apply across all identities.

Organization controls access and sending

New campaigns, audiences, templates, and sender identities select an organization. Read and write access follows the cluster's organization authorization rules; the worker checks current send permission, and the campaign, audience, template, recipient, and sender must agree on organization. A client campaign cannot fall back to the operator's sender identity.

Adding a sending identity

For ACS, use the guided connection above. It verifies the domain, creates the Azure sender username, and saves the corresponding Campaigns identity. Creating an identity manually does not prove that its address is verified.

The following instructions apply only to an existing Microsoft Graph operator mailbox configuration. They do not configure a client's ACS connection.

  1. Create the mailbox in the Microsoft 365 tenant that hosts your sending domain — the tenant MEMQL_EMAIL_AZURE_TENANT_ID names, which is not necessarily the tenant your Azure subscription lives in. A token issued for the wrong tenant is a 404 on a mailbox that plainly exists.

  2. Add it to the mail-enabled security group behind your ApplicationAccessPolicy. This is the step that is easy to miss and silent when missed, because everything else works: the row saves, the picker offers the mailbox, the campaign starts, and every message fails at the provider.

    text
    Connect-ExchangeOnline -Organization <mailbox-tenant-domain>
    Add-DistributionGroupMember -Identity "memql-mail-senders@<domain>" `
    -Member "news@<domain>"
     
    # Verify BOTH directions. A policy that grants is not evidence it denies,
    # and replication can take ~30 minutes.
    Test-ApplicationAccessPolicy -Identity "news@<domain>" -AppId <client-id>
    Test-ApplicationAccessPolicy -Identity "<a-real-person>@<domain>" -AppId <client-id>
    # want: Granted, then Denied.

    If you have no such group yet, the app is still scoped tenant-wide — Mail.Send (Application) is literally "Send mail as any user". Create the group and the policy first: Mail.Send is tenant-wide until you scope it.

  3. Publish SPF, DKIM and DMARC for the new mailbox's domain, if it is a domain this deployment has not sent from before. A new identity on an already-authenticated domain inherits its records and needs nothing here. A new domain is a new reputation: see SPF / DKIM alignment is structural, and expect to warm it — the ramp keys on the identity's normalized address, so a new mailbox starts its own ramp rather than inheriting an established one's rate.

  4. Create the row.

    text
    mutation createSenderIdentity(
    address: "news@<domain>",
    fromName: "Acme News",
    replyTo: "hello@<domain>",
    accountId: "<account id>"
    )

    address is normalized lowercase and is the reputation and warmup key, so two spellings of one mailbox would split its ramp in half. fromName is required — a From with no phrase shows the raw mailbox to every recipient.

Mail.Read matters too, and only for the default mailbox. The Graph mailbox reader reads MEMQL_EMAIL_SENDER's inbox for delivery reports, so that mailbox needs Mail.Read under the same policy group. Identity mailboxes do not need it yet: bounces for a send from news@ come back to news@, and the reader does not walk them, so a non-default identity's hard bounces are not yet feeding suppression. Plan around that until it does — the group membership is the only thing to change when it lands.

Retiring one is status: "disabled", never a delete. See disabled is how you retire a mailbox.


Importing recipients

text
builtin campaignImportRecipients(audienceId: "<id>", artifactId: "<id>", hasHeader: true)

The file is a CSV already uploaded to the Library. It is read server-side under the caller's own actor, so a file the caller cannot read is a file this cannot import — the artifact id is not a capability.

A header row is required and the column mapping IS the header. email is required (case-insensitive); displayName and name are recognized; every other column lands verbatim in the recipient's fields map, reachable from a template as {{fields.<key>}}. There is no positional import, deliberately: guessing which column holds addresses is how an import mails the wrong list.

Per row the address is normalized and shape-validated, then de-duplicated against the audience's existing recipients and against earlier rows of the same file — first occurrence wins, so a file listing somebody twice with two different names does not produce two recipients.

The import refuses whole rather than truncating. If the resulting roster would exceed MEMQL_CAMPAIGNS_MAX_AUDIENCE, nothing is written. A partially imported list is one nobody knows is partial, and the send that follows is a silent prefix of the audience the operator meant.

It returns {added, duplicates, invalid, total} plus up to twenty sample invalid lines with their line numbers, so the next action is fixing the file rather than guessing at it. Each added recipient gets a consent event (kind: "grant", source: "import") — which is what finally gives source: "import" a writer, and gives the compliance export a record of where an address came from.


Merge tags

The replacer set is closed, and is a strings.NewReplacer over enumerable keys rather than a template engine — there is no expression evaluation in a campaign body and there is not going to be:

TagValue
{{displayName}}the recipient's name, with a sensible fallback
{{email}}the recipient's address
{{campaignName}}the campaign's name
{{accountName}}the tied account's name; empty when untied, which is the ordinary case
{{fields.<key>}}one key of the recipient's fields map, as imported
{{unsubscribeUrl}}the recipient's one-click unsubscribe URL
{{preferencesUrl}}the recipient's subscription choices
{{confirmUrl}}the recipient's confirmation page
{{viewInBrowserUrl}}the sent template revision in a browser

The HTML and text parts escape differently, on purpose. Every substituted value is HTML-escaped on the HTML path and not on the text path, because the text part is not markup and escaping it would show &amp; to a reader. displayName and every fields.* value are recipient-supplied — an imported CSV is untrusted input — so that split is a security property, not a formatting one.

Recipient link tags belong in a complete link destination or as a standalone visible URL. They cannot be embedded in an address, a subject, an HTML attribute fragment, a hidden field or a link label. Formatting cannot bypass this boundary. A template with a usable {{unsubscribeUrl}} link in its HTML gets no second HTML footer; its text part needs its own standalone URL to omit the text footer. The default footer names the sender's display name, then the organization name, then “this mailing list.” It includes subscription choices and a browser view when available. The List-Unsubscribe headers remain present.

An unknown tag stays literal in the body. It is not an error and it is not blanked, because blanking it would delete the evidence of the typo. The way to catch one before the whole audience does is the test send, which reports every tag it could not resolve.


Testing a campaign with an audience

Create a separate audience containing your reviewers’ email addresses and merge fields. In Email → Settings → Testing, choose the organization, select that audience and save. This is shared cluster configuration, not a browser preference. Each organization has its own selection; an active audience from a different organization is refused. Choose None selected and save to disconnect.

Open any campaign, including a sending, scheduled, paused or completed campaign, and choose Send test. Completed campaigns are available with Show archived items enabled in Settings. A test uses the published template and the same preflight, template snapshot, queue, worker, sender resolution, suppression, merge fields, rate limits, retries, tracking and signed unsubscribe as a live send. For a repeating campaign it copies the series’ saved instruction and does not advance its next occurrence. The testing audience must differ from both the campaign’s and the series’ live audiences. It never falls back to live subscribers.

Each test has its own campaign occurrence, job and delivery ledger. Source counters, status and schedule stay unchanged. Tests are excluded from the regular campaign list and the organization’s campaign rollup. Recent tests shows the latest 50 runs and a Latest test progress bar; expand a run for per-address results. These results, campaign statistics, delivery records and audience rosters update automatically while open, with background reads every five seconds. Returning to the browser tab reads the current state immediately. Campaign results describes the original send only: if it sent one message and a later test skips an opted-out tester, the campaign remains Sent 1 / Skipped 0 and the latest test shows Sent 0 / Skipped 1. Test outcomes are never added to campaign totals. “Accepted” means the transport accepted the message, not proof of inbox delivery. Suppressed or unsubscribed testers are skipped, as they would be in a live run. Unsubscribe links are real: clicking one changes that test recipient’s consent and may suppress their address for subsequent mail from the organization.

The configured transport applies equally to tests and live sends. With capture enabled, mail appears in the Email app. With external delivery enabled, the normal organization provider sends it. A localhost unsubscribe URL can only be exercised where that local installation is reachable; it does not validate public reachability. The test runs a send immediately; it does not simulate waiting for the recurrence clock.

text
builtin campaignConfigureTestAudience(accountId: "<organization>", audienceId: "<test-audience>")
builtin campaignTestAudienceSend(campaignId: "<campaign>", audienceId: "<test-audience>", requestId: "<stable-request-id>")

Configuration changes include the expectedRevision returned by query campaignTestSettings. The send’s audienceId is the reviewed selection: if another operator changes the setting, a stale send is refused. Retain requestId after a network error and retry with the same inputs. A database lock and fresh reads make retries on separate replicas return the same run without requeuing it. A deliberate new test uses a new request id. The reply identifies testRunId; use query campaignTestRuns and the ordinary delivery queries to inspect outcomes.

Existing single-address preview API

The existing campaignTestSend DSL builtin below remains a render-only preview for existing callers. It is not used by the Email app’s Send test action and does not verify the normal queue or delivery ledger. Use the audience-based operation above for execution testing.

text
builtin campaignTestSend(campaignId: "<id>", to: "you@example.com")

Renders the campaign's template against a synthetic recipient — display name Test Recipient, the address you name, and the fields of the audience's first real recipient when one exists, so {{fields.*}} show the shape they will actually have rather than blanks. The subject is prefixed [Test] , the message goes through the campaign's resolved sending identity, and the unsubscribe footer carries an obviously-inert token.

It writes no delivery row and touches no counter, so a test can never make a campaign look partly sent. It does consume the ordinary send-rate token bucket, because a test is a real message to a real mailbox.

It returns the list of merge tags it could not resolve. That is the check that catches a typo'd {{fields.compnay}} while it is still cheap.

to is required and never defaults to the caller's own address. A builtin that mails somewhere you did not name is one whose default you have to remember.


Reading what a campaign did

text
builtin campaignStats(campaignId: "<id>")

The server returns these counts and preserves their completeness:

GroupBuckets
rosterrecipients, pending
transportsent, failed
skippedsuppressed, unsubscribed, other
bounceshard
feedbackcomplaints, unsubscribed
deliveryconfirmed, failed, expanded, unconfirmed
opens / clickstotal, unique

They are computed server-side from the delivery ledger (status plus skipReason), the campaign's own consent events, and its engagement events. If a count reaches the engine's source window, the response carries atLeast: {"sent": true} (or the corresponding dotted field, such as "opens.total"). That number is a lower bound, displayed with ≥. A missing marker means the scan proved exhaustion. Small counts retain their exact path. Do not calculate an exact delivered figure or percentage from bounded inputs; skipped.other is omitted when subtracting bounded counts could invent a total. Delivery figures come from authenticated provider reports: confirmed means accepted by the recipient's mail server, failed means a reported delivery failure, and expanded means distribution-list expansion with no final delivery claim. unconfirmed is the accepted count minus these reported outcomes and is omitted when any operand is bounded. Each reported bucket can carry its own atLeast marker. A legacy send with no delivery reports remains unconfirmed. The send preflight walks the full roster when its capacity count is bounded, so the frozen recipientCount remains exact.

skippedCount is also stored on the campaign row. recipientCount - sentCount - skippedCount - failedCount is what is still outstanding.

Two figures are honestly absent rather than rounded

Unique opens and clicks can come back unmeasured. They are folded from a bounded read of the engagement rows, and a read that comes back at its bound is a truncation. Reporting the folded number anyway would print a unique count that is quietly a floor, on the one campaign large enough that the figure mattered. At the bound the answer is unmeasured; totals remain available with their own atLeast markers when bounded.

There is no soft-bounce figure per campaign at all. Not a zero: the field is absent. Soft bounces are recorded and deliberately do not suppress, but nothing attributes one to a campaign, so a 0 here would be read as "no soft bounces" — a claim nothing in the system can make. An absent figure and a zero are different answers, and a surface rendering this must not turn one into the other.


Open and click tracking

Two booleans on the campaign, both defaulting true: trackOpens and trackClicks. An operator sending to a privacy-sensitive list turns them off per campaign.

The HTML part only. At render time every http(s) href is rewritten to a signed redirect and a 1x1 pixel is appended. The text part is untouched: there is no honest way to count an open in plain text, and rewriting a URL a reader can see would be visible mangling for a number nobody asked for.

The token is HMAC-signed by the same key ring the unsubscribe link uses, under a different context string, so an unsubscribe token can never verify as a tracking token or the reverse. Its payload carries the delivery, the campaign, the kind and — for a click — the destination URL. The destination is inside the signed payload rather than in a query parameter, which is what makes the redirect open-redirect-proof: there is no unsigned input for an attacker to aim.

EndpointBehaviour
GET /t/o/<token>always answers the 1x1 GIF; records the open only on a valid signature
GET /t/c/<token>302 to the signed URL; an invalid or tampered token renders the same "link is not valid" page an expired unsubscribe link gets — never a 500, never a redirect

Both are served by the bff on the same public origin as /unsubscribe (MEMQL_CAMPAIGNS_UNSUBSCRIBE_BASE_URL), and both are HTTP for the reason /unsubscribe is: the caller is the recipient's mail client, and there is no gRPC version of that conversation. The token has to be a single path segment — the self-authenticated exemption these routes rely on is bounded to exactly one segment under the mount, so a token containing a / is not merely mis-parsed, it is 401'd before the handler runs.

Hits land on v1:campaigns:engagementEvent, one row per hit, written under internal origin. Uniqueness is by delivery, not by address: one address in two audiences is two people as far as a campaign is concerned.

What tracking does not tell you. An open is a mail client fetching an image — clients that block remote images never report one, and clients that prefetch report one nobody read. It is a floor on engagement and a comparison between sends, not a readership figure. There is no delivered event for the same reason there is no delivered column on the reputation window: the transport says accepted and a bounce arrives later.


Running a send

  1. Author the audience, template and campaign in the Email app in Email.

  2. Mark the template ready. A draft is refused: half-written copy delivered to an audience is unrecallable, and this is the cheapest guard against it.

  3. Press Start sending, or call the builtin:

    text
    builtin campaignStartSend(campaignId: "<id>")

    The preflight refuses — with the reason — if no sender is registered, if one-click unsubscribe is unconfigured, if the template is not ready, or if the audience is empty or at the ceiling.

    From a client, the same call is a generated SDK method — the builtin is marked @sdk (memql#4239), which is what puts it on that surface: qc.CampaignStartSend(ctx, client.CampaignStartSendArgs{CampaignId: id}) in Go, query.campaignStartSend({ campaignId }) in TypeScript. The pause, resume and schedule calls below have theirs too (campaignPauseSend, campaignResumeSend, campaignScheduleSend), and the app's buttons go through those methods rather than composing the call string by hand.

  4. Watch the campaign row's counters, or the delivery ledger (deliveriesForCampaign).

Pause and resume:

text
builtin campaignPauseSend(campaignId: "<id>")
builtin campaignResumeSend(campaignId: "<id>")

Pausing leaves the ledger alone, so resuming continues exactly where it stopped.

Scheduling one

text
builtin campaignScheduleSend(campaignId: "<id>", scheduledAt: "2026-09-01T09:00:00Z")

or the Schedule send button in the editor. The send then starts on its own; nothing else has to be pressed.

scheduledAt is an RFC 3339 instant. A value with no offset is read as UTC — guessing a local zone from a node's TZ would make one string mean different moments on different replicas.

Four things are worth knowing about it:

The preflight runs when you schedule, and again when it fires. Both, and that is the point of scheduling being a builtin rather than a stored date: a campaign whose template is still a draft is refused while you are looking at the screen, not at 3am.

A time already past is refused. Use campaignStartSend to send now. A backdated schedule is far more often a typo in the year or the offset than a request to send immediately.

The campaign row decides when it fires. The send job carries a copy of the time for you to look at; the worker compares the clock against v1:campaigns:campaign.scheduledAt. So moving the date — with the editor, or with updateCampaign — moves the send, and a schedule you postponed does not go out on its original time.

A campaign whose time passed while the cluster was down still sends, when the cluster comes back. There is no window past which a late send is dropped, deliberately: a silently-skipped campaign is the failure this replaced. If you no longer want it, cancel it — a campaign sitting in scheduled is a campaign that is going to send.

If the fire-time preflight refuses, the reason lands on the campaign row's lastError, where the operator who scheduled it is looking, and the two kinds of refusal are treated differently by who can fix them:

RefusalKindWhat happens
Template un-readied, audience emptied or over the ceilingauthoringcampaign goes failed with the reason; fix and schedule again
No sender registered on the node, one-click unsubscribe unconfiguredenvironmentthe send waits and retries each tick, reason stamped on the row

The split is by who can fix it, not by severity. Failing a campaign because a node booted without its mail credentials would make an operator re-author a schedule to recover from a bad deploy.

Cross-replica, a due campaign fires once — and the claim is the least of the three reasons. The send job's id is the campaign's id, so two replicas promoting it write one row; the drain claim admits one replica per (job, progress); and the delivery ledger is per (campaign, recipient) underneath both.

Re-sending a campaign is not a thing. The ledger is per (campaign, recipient), so a second run finds every recipient terminal and mails nobody. Author a new campaign.


Feeding bounces back in

Bounces and complaints arrive out of band — Microsoft Graph's sendMail returns 202 Accepted and the bounce comes back to the sending mailbox later. Two formats parse out of the box (memql#3461):

FormatWhat it coversWho produces it
rfc3464Bounces, hard and softThe standard delivery status notification. Microsoft Graph / Exchange, Postfix, essentially every SMTP-era relay. Cannot express a complaint — nothing bounced, so there is no DSN.
sesBounces and complaintsAmazon SES feedback over SNS. Carries the complaint feedback loop a DSN structurally cannot.

Anything else needs a parser, and the honest consequence of not writing one is that its bounces never reach the suppression list.

Wiring a feed

  1. Point the provider's feedback webhook at POST /inbound/{source} (inbound delivery) and configure that source's allowlist entry and signing secret there.

  2. Name it as a feedback feed:

    shell
    MEMQL_CAMPAIGNS_FEEDBACK_SOURCES=postmaster=rfc3464,ses-feedback=ses

That is the whole wiring. A shipped automation (ingestCampaignFeedback) fires on every staged inbound row and offers it to campaignIngestFeedback, which parses and applies it.

Listing the source here is the authorization, and there is deliberately no role check on top of it. The call asserts nothing: every address and every verdict comes out of a body the provider signed with a secret you configured, arriving at a source you allowlisted, in a format you named — three deployment-level decisions, all made by whoever holds the env. A payload from a source configured scheme=none is refused, because unauthenticated input must not write a cluster-wide list. Nobody can call the builtin directly: it refuses every call that did not come from the shipped automation, before it reads the row. Re-processing a webhook you already trusted is not harmless — each pass would count its bounces into the sending ramp's reputation window again and append another consent event.

The Graph mailbox reader

On Microsoft Graph nobody dials you. A failed delivery comes back as a multipart/report DSN mailed to the sending mailbox, so the webhook path above — which is the whole ingestion story — had nothing feeding it on the transport this deployment actually sends on. Bounces landed in a mailbox and were read by no one; the suppression list looked healthy because it was empty.

The reader closes that loop. Active only when the resolved sender is Graph and campaigns are enabled, it lists the sending mailbox's inbox for unread multipart/report messages every MEMQL_EMAIL_NDR_POLL_SECONDS (default 300; 0 disables, and a non-integer value falls back to the default rather than to off), fetches each as MIME, and stages it as an ordinary v1:platform:inboundRequest with source: "graph-mailbox". Processed messages are marked read and categorized, so a restart does not re-read the mailbox from the beginning; the Graph message id is the dedupe key underneath, so a redelivery collapses onto the same row.

Two variables and one Entra fact make it work:

shell
MEMQL_EMAIL_NDR_POLL_SECONDS=300
MEMQL_CAMPAIGNS_FEEDBACK_SOURCES=graph-mailbox=rfc3464

Staging a row is not acting on one. Until graph-mailbox=rfc3464 is listed, the reader files DSNs the shipped automation then declines to process — the same "listing the source here is the authorization" rule as every other feed, applied to a feed the engine happens to fill itself. And the mailbox must be readable: the Graph application needs Mail.Read under the same ApplicationAccessPolicy that scopes Mail.Send (azure-entry-install.md), or the poll fails with a 403 the log names and the loop stays open.

signatureVerified is stamped true on these rows, and that is honest rather than a shortcut. Provenance IS the verification here: the payload was read out of our own mailbox over our own authenticated credential, and there is no third-party signature to check. That field is what gates campaignIngestFeedback, so a row that could not honestly carry it would be staged and never acted on.

Hard vs soft is the provider's word, not ours

Provider saysResult
DSN Status: 5.x.x, or Action: failedhard bounce → suppressed
DSN Status: 4.x.x, or Action: delayedsoft bounce → recorded, not suppressed
SES bounceType: Permanenthard bounce → suppressed
SES bounceType: Transient or Undeterminedsoft bounce → not suppressed
SES complaintsuppressed

Undetermined counts as transient on purpose: SES is saying it could not tell, and a permanent suppression on "could not tell" costs a real subscriber, while the other error costs at most a few more attempts at a dead address. Nothing anywhere classifies by reading the diagnostic text — a parser that looked for "user unknown" would be inventing a verdict.

A bounce is attributed to its send through the X-Campaign-Id header the sender stamps, which a DSN quotes back and SES echoes in mail.headers. Best-effort: attribution improves a review and is never a precondition for suppressing.

What happens to a payload we cannot read

It is not dropped. The inbound row is stamped failed with the reason and the call errors, so:

text
query inboundRequestsByStatus(status: "failed")

is the list of feedback this deployment could not understand. A payload that reads fine and carries no bounce — a delivery receipt, an SNS subscription confirmation — is stamped processed with what it was, because recording that as a failure would teach you to ignore failures. An SNS SubscriptionConfirmation says to visit its SubscribeURL, which is the one message that means the wiring is working.

By hand

An operator can still enter a report or suppress directly:

text
builtin campaignRecordFeedback(email: "...", kind: "hard_bounce", campaignId: "...")
builtin campaignSuppress(email: "...", reason: "manual", note: "...")

Both are admin-or-cluster-owner, because there the caller is asserting a verdict.

Reputation telemetry

Every send and every piece of provider feedback is counted per (sending identity, recipient domain, day) on v1:campaigns:reputationWindow (memql#3462). That is the breakdown that matters: mailbox providers judge a sender independently, so "our bounce rate is 1%" is not a number any of them acts on, while "our complaint rate at gmail.com is 0.4% this week" is.

text
query reputationWindowsSince(since: "2026-08-01")

Cluster-owner gated, and it carries a domain and four integers — no address anywhere, the same property that makes the suppression list safe to keep cluster-wide.

Two things it deliberately does not claim:

  • accepted is not delivered. It counts what the transport took; Graph answers 202 and the bounce arrives hours later through the feedback path. Delivery is inferred as accepted minus bounces, and there is no delivered column because nothing on this side could honestly produce one.
  • Unsubscribes are not counted. The one-click endpoint is a separate handler with its own store, so a column for them would be a column nothing writes. The ramp thresholds on bounces and complaints, which is what the providers themselves act on.

There is one counter row per replica (nodeId), written as an absolute running total rather than an increment. Two replicas incrementing one shared row would need a read-modify-write on the send path and would lose counts to the interleaving; one row each, summed at read time, has neither problem.


Warming a new sending domain

Warming is raising volume gradually on a new sending identity, so a provider sees a growing trickle rather than a cold blast.

There is now an automated ramp, and it is off by default.

shell
MEMQL_CAMPAIGNS_WARMUP_ENABLED=true
MEMQL_CAMPAIGNS_WARMUP_STEPS=5,10,25,50,100,200

An established sending domain does not want its rate re-derived by a control loop that has never seen it, which is why you have to ask for it.

It can only ever slow you down. The effective rate is min(the current step, MEMQL_CAMPAIGNS_SEND_RATE_PER_MINUTE). The ramp holds your configured rate down while the evidence is thin; it never raises it past what you allowed.

It advances on evidence, not on a clock

A fixed-schedule ramp is a guess with a schedule attached, and it produces the worst kind of false confidence — an operator believing they are warming safely while the system has no idea whether it is working. This one advances a step only when all of these hold:

ConditionKnobWhy
The step has run long enough_WARMUP_MIN_HOURS_PER_STEP (24)Providers judge over time. A step they have not seen through a daily cycle has not been judged, however clean it looks.
It has sent enough to judge_WARMUP_MIN_VOLUME_PER_STEP (200)Four messages with no bounces is a hard bounce rate of 0.0 and no evidence at all. This is the condition that stops an empty numerator reading as a clean bill of health.
Every measurable domain is inside its thresholds_WARMUP_MAX_HARD_BOUNCE_RATE (2%), _WARMUP_MAX_COMPLAINT_RATE (0.1%)Per domain, never in aggregate. One bad domain inside a large healthy total is exactly what an aggregate hides, and it is the shape that gets a sending domain blocked.

A domain over threshold reduces the ramp a step rather than merely holding it. Holding at a rate that is already producing complaints is not a neutral act.

A domain with less than _WARMUP_MIN_DOMAIN_VOLUME (50) of its own is ignored, or one bounce at a domain we sent three messages to would read as 33% and pin the ramp forever. The cost — a genuinely bad small domain is invisible to the ramp until it grows — is a real gap rather than a hidden one.

Reading what it decided

text
query warmupStateForIdentity(sendingIdentity: "sender@example.com")

carries the current step, its ratePerMinute, the last decision (started / held / advanced / reduced) and a reason in words. held is the common and healthy state, so the reason is written on every evaluation: an operator looking at a step that has not moved for two days should read why rather than guess.

A malformed _WARMUP_STEPS leaves the ramp disabled with a boot warning, rather than being sorted into a ladder you did not write.

Doing it by hand instead

Still perfectly reasonable, and unchanged:

  1. Start MEMQL_CAMPAIGNS_SEND_RATE_PER_MINUTE low (a few per minute).
  2. Send to your most engaged recipients first — split the audience rather than sampling it, so the send order is deliberate.
  3. Raise the rate over days, watching reputationWindowsSince and the domain breakdown on the suppression list.
  4. Back off on any rise in complaints.

Troubleshooting

SymptomCause
startSend refuses: "no one-click unsubscribe"MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET / _BASE_URL unset.
startSend refuses: "no email sender registered"Neither the Graph nor the SMTP credentials resolved on this node; the LogSender is not a sender for this purpose.
startSend refuses: template not readyMark the template ready.
startSend refuses: "over the ceiling"The audience is larger than MEMQL_CAMPAIGNS_MAX_AUDIENCE (default 250,000). Nothing is technically wrong with a send that size — raise it if you mean it, or check the audience is scoped the way you think.
Scheduled campaign did not sendRead the campaign row's lastError — the fire-time preflight records its reason there. An environment refusal (no sender, no unsubscribe config) retries; an authoring one leaves the campaign failed.
Scheduled campaign sent later than its timeExpected after downtime: a late send is sent rather than dropped. The log line carries lateBy.
Campaign stuck at sending, counters not movingCheck the job's throttledUntil — the provider parked it. Otherwise check that a node with a configured sender is running the worker.
The warming ramp never advancesRead warmupStateForIdentity's reason — it names which condition is unmet. Most often the step has not sent _WARMUP_MIN_VOLUME_PER_STEP messages yet, which is the ramp refusing to treat a clean rate over four messages as evidence.
The warming ramp is enabled and nothing pacesCheck the boot log for a malformed MEMQL_CAMPAIGNS_WARMUP_STEPS; the ramp disables itself rather than inventing a ladder.
Bounces never appear on the suppression listThe source is not in MEMQL_CAMPAIGNS_FEEDBACK_SOURCES, or its format is misspelled (a misspelling is dropped, not defaulted). Check inboundRequestsByStatus(status: "failed") for payloads that arrived and could not be read.
Bounces never appear, and this is a Graph deploymentNothing dials you on Graph. Check MEMQL_EMAIL_NDR_POLL_SECONDS is not 0, that graph-mailbox=rfc3464 is in MEMQL_CAMPAIGNS_FEEDBACK_SOURCES, and that the Graph app holds Mail.Read under the same ApplicationAccessPolicy as Mail.Send — a 403 on the poll is the usual answer. See the Graph mailbox reader.
startSend refuses: the sending identity is missing or disabledAn authoring refusal, so the campaign goes failed. Re-enable the mailbox (status: "active") or point the campaign at one that exists. It is deliberately not defaulted — see resolution order.
A campaign naming an identity waits forever on an SMTP nodeAn environment refusal: SMTP AUTH binds to one mailbox, so that node cannot send as anything else. The send retries each tick. Either run the send where the Graph sender is configured, or clear senderIdentityId.
Import reports invalid for every rowThe header is missing or does not carry an email column. There is no positional import: the column mapping IS the header.
Import refused and nothing was writtenThe resulting roster would exceed MEMQL_CAMPAIGNS_MAX_AUDIENCE. It refuses whole rather than truncating; split the file or raise the ceiling if you mean it.
A merge tag appears literally in the delivered mailIt is not in the closed set, or {{fields.<key>}} names a column the import did not create. Run campaignTestSend — it returns every tag it could not resolve.
campaignStats says opens are unmeasuredThe bounded engagement read came back at its bound, so a unique count would be a floor presented as a total. The total figures beside it carry atLeast when bounded.
Opens and clicks are all zerotrackOpens / trackClicks are off on that campaign, or the message went out as text only. Tracking is the HTML part only, by design. Also check MEMQL_CAMPAIGNS_UNSUBSCRIBE_BASE_URL is externally reachable — it is the origin the pixel and redirects are built from.
Everything skippedThe cluster suppression list matched. Browse v1:campaigns:suppression as the cluster owner.
Recipient says the unsubscribe link does not workMEMQL_CAMPAIGNS_UNSUBSCRIBE_BASE_URL is not externally reachable, or the key that signed it has been retired by two rotations. Check the node log for refused an unsubscribe link signed by a key this node no longer holds; if the retired value can still be recovered, putting it back in _PREVIOUS revives those links. See Rotating the unsubscribe signing key.
Boot warns "holds only ONE unsubscribe signing key"This deployment has sent campaign mail and has no MEMQL_CAMPAIGNS_UNSUBSCRIBE_SECRET_PREVIOUS. Nothing is broken yet; the next rotation of the secret alone would break every link already sent.

Azure send receipts

Before an ACS request leaves the cluster, MemQL persists an encrypted receipt with its own operation UUID and the message's internal delivery identity. A lost response or a restart never authorizes another POST for that identity. The cluster polls the original resource's operation endpoint across replicas using shared database coordination. A confirmed rate-limit refusal can retry after Azure's requested delay; an unknown outcome cannot.

In the organization's email connection detail, Check sends shows the most recent 25 Azure processing receipts and delivery-feedback readiness. Processing completed means ACS finished processing the request. Recipient outcomes are shown separately on each receipt and campaign delivery row.

Each ready organization gets a resource-scoped Event Grid subscription after the public API becomes reachable. Maintenance also discovers older connections and imported packages, resumes pending provisioning, and repairs a deleted subscription. The receiver credential is encrypted before Azure validates the endpoint, so validation can reach any replica. An unfinished subscription stays pending and retries; one unavailable organization does not stop the others or prevent processing-receipt reconciliation.

The approved HTTP exception is POST /email/events/azure. Azure sends a secret Authorization header. MemQL validates that credential, the saved subscription, the active organization connection, and the original ACS resource. A report must also match a persisted send receipt's message UUID and sender and recipient digests. Unmatched, forged, and cross-organization reports cannot change campaign state. The endpoint responds directly to Event Grid's validation challenge; it never follows the supplied validation URL. See Microsoft's delivery-property authentication and endpoint validation.

The Bearer scheme and Azure subscription name are compared without regard to case; the credential and organization ID remain exact. Duplicate or comma-joined authentication and Event Grid routing headers are refused. For rejected requests, the node logs Azure email feedback authorization refused with one fixed reason at most once per minute per reason: invalid_headers, invalid_account, invalid_bearer_scheme, receiver_unconfigured, credential_mismatch, or subscription_mismatch. These diagnostics contain no header values or secrets. Azure can return resource names with changed casing; see its resource-name rules.

Delivered confirms handoff to the recipient's mail server, not inbox placement or a read. Expanded records expansion without asserting delivery. Failed, Quarantined, and FilteredSpam record a delivery failure without inventing a permanent invalid address. Bounced and Suppressed add a global hard-bounce suppression and one consent audit event attributed to the original campaign. Later delivery reports never lift that suppression. Duplicate reports are idempotent across replicas; the newest attempt wins within a verdict rank, while a permanent bounce remains dominant. These distinctions follow ACS Email delivery events.

A valid delivery report also proves Azure accepted the original message. If its submission response was lost, MemQL repairs the existing receipt and delivery row without sending again. A durable marker requests an exact campaign and job counter reconciliation when the job reaches a terminal state. The repair walks the full ledger and clears the marker only after both counters are saved; a restart or partial failure resumes the repair. sent continues to mean transport acceptance, with provider delivery shown separately.

Processing polling stops after 24 hours if it remains unconfirmed, retaining the receipt to prevent accidental resubmission. Authenticated delivery feedback can still resolve that receipt later. Reconnecting to a different Azure resource does not move old operations: they belong to the original resource. No message body, mailbox address, or access key appears in the receipt status response. Disconnecting email stops new sends and pauses reconciliation until the original resource is connected again.

The Email app

Email brings Campaigns, Automations, Audiences and Templates into one app. Overview shows recent sends and activity. Inbox captures messages for owners and developers when the cluster uses capture mode; Logs follows the reader's access. Settings holds the sending domain, senders, testing audience and package configuration for each organization.

Use Add a campaign to choose an audience, template, sender and schedule. Create new template opens the editor and keeps the campaign's answers while you work. Templates have their own pages, formatted and plain-text previews, and publication or archive actions. A template MemQL is writing shows Writing, with its time and Cancel, and one that failed shows Failed with Retry. Settings holds each organization's Brand page, which sets the look of new emails. See Composing an email.

Automations send a sequence when someone joins an audience or confirms a subscription, or send one email when a MemQL event occurs. Build the sequence as steps, or describe it to produce an unsaved proposal. Save draft keeps that proposal; Turn on asks for confirmation before it starts sending. Each live sequence shows its enrolled, waiting and finished counts. Pause stops new sending; retirement keeps the automation's history.

Audiences distinguish subscribers from the whole list, including people waiting to confirm. Add people by hand or import a CSV file; the import report stays on screen until you finish reviewing it. Connect a signup form from the audience's page. A confirming audience uses an automation to ask for confirmation.