Back

One Bad Sender, Contained

By Pablo Fernandez8 min read

Every customer of Mailingest, my mail platform, sends through the same Amazon SES account. Until a commit on November 7, SES also saw them as one sender. It counted one bounce rate and one complaint rate, and if those went bad it had one thing it could pause: the account. A single customer who uploaded an old list could stop the mail of everyone else.

SES has had an answer to this since August 2025, tenants, and wiring it in took one commit. What took more thought was the question it raises on a platform with more than one way out. When SES pauses one customer, Mailingest still has its own outgoing server sitting right there. Should the mail go out that way instead?

One account, one reputation

The outgoing path has three transports in a chain: SES first, then Cloudflare Email Service, then Mailingest's own server. If one has trouble, egress hands the message to the next. Cloudflare only takes mail from domains in Mailingest's own Cloudflare account, so for a customer's domain the chain is really SES, then Mailingest's own server. Nearly all customer mail leaves through SES.

org A ──┐org B ──┼──▶ one SES account ──▶ Gmail, Outlook, Yahoo ...org C ──┘ one bounce rate, one complaint rate one pause, for everyone
Before tenants: every organization's mail reached SES as one sender, judged as one.

Mailingest does keep a reputation of its own. Since October 18 it measures every domain and every account over seven days (recipients, distinct hard bounces, distinct trusted complaints) and suspends either one past a threshold, with no verdict below 1,000 recipients. That layer is supposed to catch a bad customer before SES ever has to.

The security audit on November 7 found it was half blind. A complaint only moves that reputation if it's trusted, meaning signed by a feedback loop the operator lists or made through the message's own report-abuse link. Complaints that SES forwarded through its signed events were recorded but trusted by neither rule. The fix was a new reporter value, and its comment says what was wrong:

crates/db/src/models.rs
/// The `reporter_domain` of a complaint a relay told us of through its own signed events (SES's
/// feedback loops by SNS): the mailbox provider's report, relayed by the relay that carried the
/// message, so reputation trusts it as it trusts a feedback loop's own. Not a domain, as above.
/// Without it, complaints about mail SES carried (nearly all of it) never counted towards an
/// account's or domain's pause, and SES judged the shared account by them instead.
pub const RELAY_FEEDBACK_REPORTER: &str = "relay:feedback-loop";

So the only thing watching complaints about customer mail was SES, and SES could only answer at the level of the whole account.

A tenant per organization

A tenant, in AWS's words, is a container inside one SES account with its own identities, configuration sets and reputation metrics. SES tracks bounces and complaints per tenant, and a reputation policy decides when to pause one. New tenants get the Standard policy, which pauses on high-severity findings and leaves the others sending.

In Mailingest the organization is the unit that owns domains and pays, so that's the tenant. The name is derived, never stored as a choice:

crates/core/src/transport.rs
/// The SES tenant of organization `organization_id`: `org-` and its id in hex, 36 characters
/// (SES takes up to 64, letters, digits, `-` and `_`). One per organization, so SES weighs and,
/// when it must, pauses each customer's sending on its own (docs/MTA_DUAL_2026-10-29.md §6.5).
pub fn ses_tenant(organization_id: uuid::Uuid) -> String {
    format!("org-{}", organization_id.simple())
}
org A ──▶ tenant org-0a1f... ──┐org B ──▶ tenant org-7c3e... ──┼──▶ one SES accountorg C ──▶ tenant org-d92b... ──┘ rates and pause per tenant
After tenants: the same account, but SES keeps the numbers and the pause switch per organization.

Naming a tenant before it exists

There is one way to get this wrong that SES punishes immediately. A message names its tenant over SMTP with an X-SES-TENANT header, and SES checks that the identity and configuration set the message uses are associated with that tenant. If they aren't, the send fails. Naming a tenant one second too early would turn working mail into refused mail.

So the order is strict. The identity sync that already keeps customer domains verified in SES now also creates the organization's tenant if it's missing, associates the domain's identity and the configuration set with it by ARN, and only after SES confirms both writes the tenant into transport_identities.tenant (migration 673). Egress reads that column. Until it's set, mail goes out with no tenant, exactly as all mail did the day before.

domain identity verified in SES │ ▼CreateTenant org-<id> already exists: fine │ ▼associate identity ARN, then configuration set ARN │ ▼write transport_identities.tenant only now │ ▼egress adds X-SES-TENANT: org-<id>
The tenant is recorded only after SES has the associations, and egress names only what is recorded.

On the egress side it's a header placed in front of the message, for SES only:

services/egress/src/transport.rs
let tenant = match (relay.kind, self.tenant) {
    (TransportKind::Ses, Some(tenant)) => format!("X-SES-TENANT: {tenant}\r\n"),
    _ => String::new(),
};
let with_prefix;
let message = if relay.prefix.is_empty() && tenant.is_empty() {
    self.message
} else {
    with_prefix = [relay.prefix.as_bytes(), tenant.as_bytes(), self.message].concat();
    &with_prefix
};

The reverse order matters too. SES won't delete an identity that is still associated with a tenant, so deleting a domain's SES identity now calls leave_tenants first, which lists the identity's tenants and takes it out of each.

A pause that must not fail over

Now the question from the top. The chain exists so that a problem with one transport doesn't stop mail. When SES refuses a transaction, egress sorts the refusal: throttling means try the next transport and let SES cool down, an unverified identity means try the next transport without blaming SES, anything else means SES is unavailable for a while.

A paused tenant fits none of those. It isn't SES having a problem. It's SES saying that this customer's mail is the problem. If egress treated it like an outage, the paused customer's mail would leave through Mailingest's own server a moment later, from Mailingest's own IPs, and the pause would only change which reputation the bad list damages. So it gets its own refusal, checked before the others:

crates/outbound/src/transport.rs
TransportKind::Ses => {
    // A tenant SES paused (its reputation policy, or Trust & Safety): this customer's
    // sending alone, never the relay's. An account pause is the relay's, and fails over.
    let tenant_paused = text.contains("tenant")
        && ["paus", "disabled", "suspend", "enforce"]
            .iter()
            .any(|w| text.contains(w));
    if tenant_paused {
        Refusal::SenderPaused
    } else if text.contains("throttling") || text.contains("quota exceeded") || code == 454
    {
        Refusal::Throttled
    } else if text.contains("not verified") || code == 552 {
        Refusal::Ineligible
    } else {
        Refusal::Unavailable
    }
}

It's a match on words, not on a reply code. An SMTP refusal is a code and a line of text, and the code alone doesn't say whose sending was paused. A refusal that doesn't mention a tenant, an account-wide pause among them, lands in Unavailable, and mail moves to the next transport as it always did. The test pins both sides: "Sending paused for this tenant" is held, "Sending paused for this account" fails over.

SES refuses the transaction │ ├── "tenant" + paus / disabled / suspend / enforce ──▶ Held, no other transport ├── throttling, quota exceeded, 454 ─────────────────▶ next transport, SES cools down ├── "not verified", 552 ─────────────────────────────▶ next transport, no blame └── anything else, account pause included ───────────▶ next transport, SES cools down
Of the four ways SES can refuse, only a paused tenant stops the chain.

In the loop that walks the chain, the new outcome returns early. It never reaches the line that hands the message to the next step:

services/egress/src/transport.rs
Outcome::SenderPaused(why) => {
    mailingest_observability::telemetry::transport_send(
        step.kind.as_str(),
        "sender_paused",
    );
    tracing::warn!(transport = %step.kind, reason = %why, "the relay paused this sender: held, not passed on");
    return Carried {
        attempt: DomainAttempt::Held(format!(
            "Sending is paused for this sender: {why}"
        )),
        step,
        failed_over_from,
    };
}

Held is the state Mailingest already used for its own limits, like a destination's rate. A held email is tried again after the base delay (RETRY_BASE_DELAY_SECS, 300 seconds by default, plus up to a quarter of jitter) without spending one of its attempts, and stops only at the age limit (RETRY_MAX_AGE_SECS, five days by default).

That's where the real seam is. AWS's docs say that once a tenant is paused, every send through it fails "until you review the issue and manually re-enable sending". Mailingest doesn't listen to SES's tenant status events on EventBridge yet, so nothing in the platform notices a pause except the refusals piling up as held mail and a sender_paused outcome on the mailingest_transport_sends_total counter. If no one resumes the tenant within five days, that customer's mail fails for good. For a customer whose list really is bad, that may be the right result. For one paused by mistake, five days is the whole window someone has to notice.

The suppression list stays shared

Tenants can also have their own suppression list. By default all tenants share the account's, so an address that bounced or complained for one customer is suppressed for all of them. SES offers a tenant-level scope where each tenant's bounces and complaints only affect that tenant.

Mailingest keeps the account scope on purpose. Its design doc says the shared list protects every customer, and the tenant scope would make SES stop checking it for that tenant's sends. An address that complained about one customer's newsletter has told the platform something useful about the next customer too.

The same audit closed a hole that came from this sharing. Deleting a suppression in Mailingest used to delete the address from SES's list and Cloudflare's as well, so the platform's list stayed the one that decided. But SES's list is one for every customer. Any customer could add a manual suppression for any address, delete it, and SES would forget that address's bounces and complaints for everybody. Now deleting a suppression removes only the customer's own row, and a later batch of the audit took ses:DeleteSuppressedDestination out of the IAM policy altogether.

What it costs, and what it doesn't fix

Setup is one environment variable and a longer IAM policy. The sync names resources by ARN, so it needs SES_ACCOUNT_ID; without it no tenant is made and mail goes out as before. The SES user gains eight tenant permissions, from ses:CreateTenant to ses:ListTenantResources, and if they're missing the sync logs it and mail still leaves without a tenant. SES charges extra per tenant per month based on email volume (the pricing page has the rates), and an account can hold 10,000 tenants per region by default, with increases up to 300,000.

What a tenant doesn't do is cut the customers apart completely. AWS says so in a note on the same page: tenants isolate the tracking, but their combined sending still counts towards the account's reputation, and a tenant with poor habits can still put the whole account at risk. That's why it mattered that the October layer started counting SES's complaints. It suspends a bad account or domain inside Mailingest before it sends enough to hurt the account SES is judging.

All of this is on Mailingest's main branch: tenant creation and association, the header, and the held state. The spam campaign post ended on this problem: on a mail platform, every customer pays for one bad account. A tenant gives SES a name for each customer, so it can pause one and leave the rest sending. Mailingest's part is to make sure that pause holds, and to keep the paused customer's mail off the other two transports.

Related articles

3D Bot Avatars From One SVG Path

One flat SVG outline and two eye positions become a character that turns, blinks and thinks. How Open Bot Avatar fakes depth, and why a model can draw one.

350,000 Rows in One Fast Table

Virtualizing 350,000 rows is the easy part. The counts and filter lists around them took seconds, until Postgres started saying which columns changed.

One Bot, Three Chat Apps

Same bot: a few lines on Telegram, a gateway and intents on Discord, a headless browser posing as a phone on WhatsApp. The hard part was never the bot.