Sub topic 9
Exceptions: New Subscribers, Transactional Mail, and Seasonal Senders
This chapter assumes you have read the earlier chapters. You should know how a sunset policy defines engagement (clicks and purchases, not opens). You should also know how an inactivity window works and how a re-engagement campaign leads to suppression. You need basic SQL and Python to follow the code.
A sunset rule such as "no click or purchase in 180 days, then suppress" is easy to state. It is also wrong for some people. Applied blindly, it suppresses subscribers who have not had a fair chance to engage. It can block password resets. It can wipe out a seasonal retailer's best customers in the off-season. Exceptions are the cases where the rule's assumptions do not hold.
What makes something an exception
The sunset rule assumes three things:
- The subscriber has had enough messages to react to.
- The messages sent are the kind a subscriber chooses to engage with.
- Your sending pattern is steady enough that 180 days of silence means disinterest.
Each exception in this chapter breaks one of these assumptions.
| Case | Assumption broken | Typical handling |
|---|---|---|
| New subscriber | Not enough mail received yet | Minimum tenure before evaluation |
| Transactional mail | Mail is not optional engagement | Exclude the stream from sunset |
| Seasonal sender | Silence does not mean disinterest | Longer window for that segment |
| Recent purchase or active account | Engagement happened outside email | Count it as engagement or hold |
| Manual hold | A person has decided | Explicit, logged override |
Exception 1: new subscribers
Your SQL from the earlier chapter already filters on subscribed_at < now() - interval '180 days'. Your Python function falls back to subscribed_at when no engagement exists. Both give new subscribers a built-in free period, so a plain signup is rarely at risk. Three situations break that protection.
Re-subscribers. Someone who was suppressed and later signs up again may have an old subscribed_at. The record looks ancient, with no recent engagement, so it is suppressed again immediately. Reset subscribed_at on a fresh opt-in. Better, store each opt-in as its own row or event.
Imported lists. After a migration or acquisition, subscribed_at often holds the import date. That makes old, cold addresses look new, and they escape the sunset for six months. If you have the original consent date, use it. If you do not, treat the import date as the start of the clock but send these addresses a short, careful series first. Imported addresses carry more spam-trap risk than fresh signups (see the earlier chapter on spam traps).
Short windows with a minimum tenure. If you use a short window, such as 90 days for a daily sender, a new subscriber could be evaluated after only a few messages. Add a minimum tenure measured in days, and optionally a minimum number of messages delivered. A minimum of 60 days is a reasonable start for weekly senders.
Exception 2: transactional mail
Transactional mail is sent because the recipient did something: a receipt, a password reset, a shipping notice, a security alert. The person did not choose it as a series of messages to read. Your sunset policy exists to protect the engagement signals of your marketing mail, so it should not apply to this stream.
There are three reasons to keep the two apart:
- A subscriber who ignores your newsletter for a year may still need a password reset tomorrow. Blocking it creates a support problem and a lost sale.
- Transactional messages generally get high engagement. Mixing them into the same engagement calculation hides how cold your marketing audience is.
- Mailbox providers see your sending domain and IP address. If transactional and marketing mail share both, a marketing reputation problem can slow down receipts and resets. Many senders use separate subdomains or IP pools for the two streams.
The practical fix is to scope every suppression to a stream. A single global "do not send" flag is the common mistake.
CREATE TABLE suppressions (
subscriber_id bigint NOT NULL,
stream text NOT NULL
CHECK (stream IN ('marketing', 'transactional', 'all')),
reason text NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (subscriber_id, stream, reason)
);
-- A sunset suppression blocks marketing only.
INSERT INTO suppressions (subscriber_id, stream, reason)
VALUES (42, 'marketing', 'sunset');
-- A hard bounce blocks everything, because the address cannot receive mail.
INSERT INTO suppressions (subscriber_id, stream, reason)
VALUES (43, 'all', 'hard_bounce');
-- Check before sending a password reset to subscriber 42.
SELECT NOT EXISTS (
SELECT 1
FROM suppressions
WHERE subscriber_id = 42
AND stream IN ('transactional', 'all')
) AS can_send_transactional;For subscriber 42, the final query returns true. The sunset suppression is scoped to marketing, so the reset still goes out. A hard bounce on subscriber 43 would return false, which is correct, because the address is dead for every stream.
A complaint or an unsubscribe is different from a sunset. A spam complaint on a marketing email should block marketing. Whether it should also block transactional mail depends on your policy and local law, so decide it deliberately and write it down.
Exception 3: seasonal senders
The 180-day window assumes steady sending. A seasonal sender breaks that. Consider a tax-preparation service, a ski resort, a school-supplies retailer, or a gift shop that does most of its business in November and December. A customer who bought last December and never clicked in the following ten months is not inactive in any useful sense. They are waiting for the next season.
Applying a 180-day window to this customer would flag them in June and suppress them in July. You would remove them just before the period when they are likely to buy again.
There are two ways to handle this.
- A longer window for the seasonal segment. Set the window to at least one full cycle plus a margin. For an annual peak, 400 days or more. The customer then gets one full season to respond before they are judged.
- Evaluate only after the season. Skip the sunset run during the off-season and run it shortly after the peak ends. Engagement is measured against the season you just had, when people had a reason to act.
The second method needs care. The sunset job should never be completely off. Hard bounces and complaints still need handling all year.
Other exceptions you will meet
Not every exception has a name in the chapter title. These come up often enough to plan for:
- Purchases and account activity outside email. Someone who buys through a direct visit, or logs in to your app weekly, is engaged. If your engagement definition only counts email clicks, you will suppress paying customers. Include purchases in
last_engaged_at, as the earlier SQL does. - Active subscriptions. A customer on a recurring plan may never click an email. Consider a hold while the plan is active, or move them to a lower-frequency stream.
- Manual holds. Account managers, partners, and VIP customers may need a human-owned override. Store who set the hold, why, and when it expires. A hold with no expiry date will outlive its reason.
Putting the checks in order
The order of checks matters. Hard problems come first, because they override any grace period. Exemptions come before the engagement test. The sunset clock only runs for people who pass all of them.
Implementing the exceptions in code
The function below extends sunset_stage from earlier. It adds a manual hold, a minimum tenure, a per-segment window, and purchase activity as engagement. It also handles an edge case: a reengagement_sent_at from an earlier cycle. If a subscriber engaged after that message and later went quiet again, the old timestamp must not trigger an instant suppression. They are owed a new re-engagement message.
from dataclasses import dataclass
from datetime import datetime, timedelta
WINDOW_DAYS = {"general": 180, "seasonal_retail": 400}
MIN_TENURE_DAYS = 60
GRACE_DAYS = 30
@dataclass
class Subscriber:
subscribed_at: datetime
last_engaged_at: datetime | None = None
last_purchase_at: datetime | None = None
reengagement_sent_at: datetime | None = None
segment: str = "general"
on_hold: bool = False
def sunset_decision(sub: Subscriber, now: datetime) -> str:
if sub.on_hold:
return "exempt_hold"
if now - sub.subscribed_at < timedelta(days=MIN_TENURE_DAYS):
return "exempt_new"
window = timedelta(days=WINDOW_DAYS.get(sub.segment, WINDOW_DAYS["general"]))
candidates = [sub.subscribed_at, sub.last_engaged_at, sub.last_purchase_at]
reference = max(t for t in candidates if t is not None)
if now - reference < window:
return "active"
sent = sub.reengagement_sent_at
if sent is not None and sent < reference:
sent = None # message belongs to an earlier cycle
if sent is None:
return "send_reengagement"
if now - sent < timedelta(days=GRACE_DAYS):
return "waiting"
return "suppress"
if __name__ == "__main__":
now = datetime(2026, 11, 26)
cases = {
"new signup": Subscriber(datetime(2026, 10, 20)),
"seasonal buyer": Subscriber(
datetime(2024, 3, 1),
last_purchase_at=datetime(2025, 12, 10),
segment="seasonal_retail",
),
"cold general": Subscriber(
datetime(2024, 3, 1), last_engaged_at=datetime(2026, 2, 1)
),
"cold, grace over": Subscriber(
datetime(2024, 3, 1),
last_engaged_at=datetime(2026, 2, 1),
reengagement_sent_at=datetime(2026, 10, 1),
),
"vip hold": Subscriber(datetime(2024, 3, 1), on_hold=True),
}
for name, sub in cases.items():
print(f"{name}: {sunset_decision(sub, now)}")Running it prints exempt_new for the new signup, active for the seasonal buyer, send_reengagement for the first cold subscriber, suppress for the second, and exempt_hold for the VIP. The seasonal buyer last purchased 351 days before the run date. Under the general 180-day window this person would be flagged. Under the 400-day seasonal window they stay active.
The function returns a decision for the marketing stream only. It never touches transactional mail. Hard bounces and complaints are handled before this function runs, as the diagram shows.
Common mistakes
- Using one global suppression flag. A sunset then blocks password resets. Scope suppressions by stream.
- Trusting
subscribed_atafter imports and re-signups. Old addresses look new, or new opt-ins look old. - Giving every segment the same window. The window should come from the segment's sending cadence.
- Leaving holds without an owner or expiry. Exceptions pile up until the policy covers nobody.
- Treating an exception as an exemption from bounce rules. Hard bounces and complaints override every exception.
- Not logging exceptions. If you cannot say why a subscriber was exempt, you cannot defend or review the decision later.
Exercise
A language-learning app sends a weekly newsletter. Subscriber Dana joined 45 days ago and has never clicked. She also bought a yearly plan 20 days ago, and last week she requested a password reset. Your policy has a 180-day window, a 60-day minimum tenure, and treats purchases as engagement. What should the sunset job do about her marketing mail and her password reset, and which two checks in the diagram decide this?
Show answer
The job should do nothing to her marketing mail, and the password reset should be sent. She is under the 60-day minimum tenure, so the "Under minimum tenure?" check exempts her as new. Even without that, her purchase 20 days ago counts as engagement and puts her well inside the 180-day window, so the "Engaged within segment window?" check would return active. The password reset is transactional, so no sunset suppression applies. Only a hard bounce or complaint, handled first in the diagram, could block it.
Exercise
A gift retailer sends daily in November and December, then once a month until October. Their sunset job uses a 180-day window and ran for the first time in July. What goes wrong, and give two ways to fix it.
Show answer
By July, most customers who last bought in December have gone more than 180 days without a click or purchase. The job flags them for re-engagement and then suppresses them, so the retailer loses its best seasonal buyers just before the next peak. Fix it by giving the seasonal segment a longer window of at least one full cycle plus a margin, such as 400 days, or by running the sunset evaluation only after the peak season ends, measuring engagement against the season that just happened. Hard bounces and complaints should still be handled all year.