ClientsPlace sends a weekly "Client Pulse" digest to workspace owners and admins: which clients need attention, new feedback, and what changed since last week. It's a recurring Hangfire job on .NET with PostgreSQL behind it. One Monday it sent the same digest again, then again an hour later, and again an hour after that, until our mail provider blocked outgoing mail on the mailbox.
That mailbox carries every product's mail, not only digests. A block there also stops sign-up, invitation and billing e-mails. A nice-to-have weekly summary ended up stopping mail that really matters.
Here is what happened, and the rules we follow for mail jobs now.
The failure mode: throwing after the send
The original job looked roughly like this:
[ AutomaticRetry ( Attempts = 24 ) ] // retried hourly public async Task Run ( CancellationToken ct ) { foreach ( var user in recipients ) { if ( await db . DigestReceipts . AnyAsync ( r =& gt ; r . WorkspaceId == workspaceId & amp ; & amp ; r . UserId == user .…