Email that sends like a person would, from the right sender
Automated client email for many agencies, built so it would sooner send nothing than send a broken message or send from the wrong company.
The problem
There was no sequence engine before August 2026. I built the first one for the billing emails that follow a signed contract, then extended it to welcome emails.
The sender settings around it were fiction. A setting labelled as using the organization's defaults wrote nothing and fell through to one address for the whole platform. No organization had its own sending identity. The preview showed a hard-coded sender. The option to copy the account manager actually resolved to the account owner.
The platform serves more than one agency. An email to an agency's client, sent from another company's address, is not a small bug.
No fallback sender
Sending from the wrong company is worse than not sending.
An agency never sends from the platform's address. Each one gets its own verified sending identity. If that identity is missing or unusable, delivery is blocked with a recorded setup error. There is no fallback to fall through to.
const sender = await findSenderFor(agency, purpose);
// No usable sender means no send. There is deliberately no fallback
// to the platform's own address.
if (!sender || !sender.isVerified || !sender.isActive) {
throw setupRequired('Assign and verify an agency sender before sending.');
}
// Whatever the caller asked for, From and Reply-To are the agency's.
message.from = sender.address;
message.replyTo = agency.replyAddress;To make that practical, I reserved addresses on a shared domain so an agency can send without touching DNS. They are outbound only, and replies go to the agency's existing inbox. I deliberately left receiving, forwarding and automatic provisioning out.
Hold it back rather than send it broken
A welcome email that opens with an empty space where the account manager's name should be is worse than no email. So if a variable cannot be resolved, that step is skipped and the contract's owner is alerted.
if (rendered.kind === 'unresolved') {
await markSkipped(delivery, rendered.reason);
// The email is not sent. The contract's owner hears why, once per
// step, so someone can assign the missing role and resend.
if (!isTestRun) await alertOwnerOnce(sequence, step, rendered.missing);
// A failed alert never undoes the skip; the sequence moves on.
return { status: 'skipped', next: await advance(sequence) };
}Two details matter. The alert goes out once per sequence and step, however many times the job retries. And a failed alert never blocks the skip: it is logged, not thrown. Contract creation also warns up front when the people an email needs are missing.
Send like a person would
A payment reminder can land whenever its delay expires. A welcome sequence is the first thing a new client hears, so it sends on weekday mornings in Central time, never overnight and never at the weekend.
const WINDOW = { timeZone: 'America/Chicago', opens: 10, closes: 17 };
function canSendNow(now: Date): boolean {
const local = inTimeZone(now, WINDOW.timeZone);
if (isWeekend(local)) return false;
return local.hour >= WINDOW.opens && local.hour < WINDOW.closes;
}
// A delivery that comes due outside the window waits for the next morning.The time zone arithmetic goes through the runtime's time zone rules, not a fixed offset, so 10:00 means 10:00 on both sides of a clock change. Delays count business days too: two days after a Friday signing is Tuesday. A version already published keeps calendar days until someone republishes it.
A test lab on the real engine
The first tool for testing welcome emails was a simulator. It never ran the real delivery code, so a passing test said little about what a client would receive.
The test lab reverses that. It runs the published sequence through the real engine on real rows. The test contract is inserted already signed, so no billing, Stripe or signing automation runs. One recipient is enforced at send time, with no copies and no follow-on actions.
Underneath sits an older guard, from July, that stops non-production environments emailing real people at all.
function deliveryMode(): 'live' | 'restricted' {
// Only production sends to real people by default.
return isProduction() ? 'live' : 'restricted';
}
// In restricted mode a recipient must be on an allowlist.
// An empty allowlist blocks everyone.
const blocked = recipients.filter((to) => !allowlist.includes(to));The smaller rules
- Emails from the builder never go to demo clients. The check fails closed, so an error retries instead of sending.
- The sender is resolved in order: a named sender, then whoever holds the role, then the contract's welcome sender.
- A welcome sequence is opt-in per contract and off by default.
- Bulk sends are paced below the provider's limit of ten requests a second: five for blasts and two for sequences. Send keys make a retried send safe for twenty-four hours.
What was mine
Most of the sequence code is mine. A teammate built form links and form assignment inside emails, and an operations colleague wrote the welcome copy.
What I can't tell you from the record: how many emails have been sent, whether any agency is live on its own sender, or what the emails achieved. Two of the sender pull requests note that assignment and test sends had not yet been performed against production.