Sub topic 10
Suppressing instead of deleting, and keeping records
This chapter assumes you have read the earlier chapters on defining engagement, choosing an inactivity window, and running a re-engagement campaign. You should be comfortable reading SQL and short Python. Here you handle the last step of the sunset flow: what happens to an address after the grace period ends without a response.
Why suppression beats deletion
When a subscriber fails the re-engagement test, the obvious move is DELETE FROM subscribers. That is usually the wrong move, for four reasons.
- The address comes back. Addresses return through list imports, a sales team's spreadsheet, a signup form on a partner site, or a restored database backup. A deleted address has no memory attached, so your system treats it as a brand-new contact and mails it again. If it was suppressed for being inactive, you have just undone your own policy.
- You lose the evidence. If an inactive address later turns out to be a spam trap, or a complaint arrives, you need to know when you last mailed it and what you knew about it. Deleted rows cannot answer that.
- You lose the audit trail. Consent records, unsubscribe timestamps, and the reason for each status change are what you show a regulator, a partner, or your ESP's abuse team.
- You cannot measure the policy. The measuring chapter compares suppressed cohorts with active ones. That comparison needs the suppressed rows.
A suppression is a record that says "do not send to this address", stored apart from the active list. The address stays in your system, but no send job can select it.
Suppress, delete, and anonymize
These three actions are often confused. They solve different problems.
| Action | What happens to the data | Can the address be mailed again? | Typical use |
|---|---|---|---|
| Suppress | Address kept, flagged as blocked, with reason and dates | No, until a deliberate release | Sunset, hard bounces, complaints, unsubscribes |
| Delete | Subscriber row and related data removed | Yes, if the address is re-imported | Erasure requests (apart from a minimal suppression entry), expired retention |
| Anonymize | Identifying fields replaced or removed | Not applicable, the person is no longer identifiable | Long-term analytics after retention expires |
The overlap matters when someone asks you to erase their data. You can delete their profile and history, but you should keep a minimal suppression entry so you do not re-add them later. Many privacy regimes accept this because it serves the person's own wish not to be contacted. The details vary by jurisdiction, so confirm your retention rules with whoever handles privacy law for your organization.
The lifecycle of a suppressed address
Suppression is a state with defined exits, not a dead end.
Two rules keep this diagram honest. Only a fresh, deliberate action by the person returns them to Subscribed, such as a new opt-in or a purchase that proves the address is live. A background import or an admin editing a status field never does. And every transition writes a record, which the next section describes.
Designing the suppression table
Keep suppressions in their own table, separate from the subscriber's status column. The status column answers "can I mail this person right now?" The suppression table answers "why not, since when, and under which rule?"
CREATE TABLE suppressions (
id bigserial PRIMARY KEY,
email_hash bytea NOT NULL,
subscriber_id bigint REFERENCES subscribers (id) ON DELETE SET NULL,
reason text NOT NULL
CHECK (reason IN ('sunset', 'hard_bounce', 'complaint', 'unsubscribe', 'manual')),
policy_version text NOT NULL,
last_engaged_at timestamptz,
reengagement_sent_at timestamptz,
suppressed_at timestamptz NOT NULL DEFAULT now(),
released_at timestamptz,
release_reason text
);
CREATE UNIQUE INDEX suppressions_one_active_per_reason
ON suppressions (email_hash, reason)
WHERE released_at IS NULL;Each column earns its place:
email_hashis the lookup key. Store a hash of the normalized address (lowercased, trimmed) so you can check an incoming address even after the subscriber row is gone.ON DELETE SET NULLonsubscriber_idlets you purge the profile without destroying the suppression.reasonseparates sunset suppressions from the others. This matters because the release rules differ, as covered below.policy_versionrecords which version of your written policy made the decision, for example2026-11-v2. When you change the window from 180 to 120 days, old records still show the rule that applied at the time.last_engaged_atandreengagement_sent_atare a snapshot of the evidence at the moment of the decision. Do not recompute them later from event tables that you might prune.released_atandrelease_reasonmake release a recorded event. You never delete a suppression row to reverse it.- The partial unique index prevents duplicate active suppressions for the same address and reason, while still allowing history after a release.
A plain hash of an email address is pseudonymous, not anonymous. Email addresses are easy to guess, so anyone with a list of candidates can hash them and compare. Treat the hash column as personal data for access control and retention purposes.
Suppressing in one transaction
The suppression insert and the status update must succeed or fail together. Otherwise you can end up with a suppression record but a still-mailable subscriber, or the reverse. This query assumes a reengagement_sends table with one row per subscriber per campaign, holding subscriber_id and sent_at.
BEGIN;
WITH due AS (
SELECT s.id,
s.email,
MAX(e.occurred_at) AS last_engaged_at,
r.sent_at AS reengagement_sent_at
FROM subscribers s
JOIN reengagement_sends r
ON r.subscriber_id = s.id
LEFT JOIN engagement_events e
ON e.subscriber_id = s.id
AND e.event_type IN ('click', 'purchase')
WHERE s.status = 'subscribed'
AND r.sent_at < now() - interval '30 days'
GROUP BY s.id, s.email, r.sent_at
HAVING MAX(e.occurred_at) IS NULL
OR MAX(e.occurred_at) < r.sent_at
),
inserted AS (
INSERT INTO suppressions
(email_hash, subscriber_id, reason, policy_version,
last_engaged_at, reengagement_sent_at)
SELECT sha256(convert_to(lower(btrim(email)), 'UTF8')),
id,
'sunset',
'2026-11-v1',
last_engaged_at,
reengagement_sent_at
FROM due
ON CONFLICT DO NOTHING
RETURNING subscriber_id
)
UPDATE subscribers
SET status = 'suppressed'
WHERE id IN (SELECT subscriber_id FROM inserted);
COMMIT;The HAVING clause keeps only subscribers with no click or purchase after the re-engagement message went out. Anyone who responded stays subscribed. sha256(bytea) is built into PostgreSQL 11 and later, so no extension is needed.
Run the due query as a plain SELECT first and review the count. A sunset run that suppresses far more addresses than you expected usually means a broken event feed, not a suddenly disengaged audience.
Making the send path respect suppressions
A suppression only works if every sending route checks it. Check in three places:
- List building. Segment queries filter on
status = 'subscribed', which the transaction above updates. - Import. Every import compares incoming addresses against
suppressionsby hash before inserting anything. - Your ESP. Push sunset suppressions to your ESP's suppression list too, if it has one. Then a send from another tool, a forgotten automation, or a manual export still cannot reach the address.
The second check is the one most often missing. A short Python function shows the import guard:
import hashlib
def email_hash(email: str) -> bytes:
return hashlib.sha256(email.strip().lower().encode("utf-8")).digest()
def filter_import(rows: list[str], suppressed_hashes: set[bytes]) -> tuple[list[str], list[str]]:
accepted, blocked = [], []
for email in rows:
if email_hash(email) in suppressed_hashes:
blocked.append(email)
else:
accepted.append(email)
return accepted, blocked
if __name__ == "__main__":
blocked_hashes = {email_hash("[email protected]")}
ok, blocked = filter_import(
["[email protected] ", "[email protected]"], blocked_hashes
)
print("import:", ok)
print("blocked:", blocked)The Python hash matches the SQL one because both normalize the same way: trim, lowercase, UTF-8, SHA-256. If the two sides normalize differently, the lookup silently fails and suppressed addresses slip through. Test that equality once with a known address.
Rules for releasing a suppression
Release rules depend on the reason:
| Reason | Can it be released? | Condition |
|---|---|---|
| `sunset` | Yes | The person opts in again, or makes a purchase or account action that shows the address is live and that they want mail |
| `hard_bounce` | Rarely | The person supplies the address again and a confirmation email is delivered |
| `complaint` | No by default | Only on a documented, explicit request from the person |
| `unsubscribe` | Only with fresh opt-in | A new signup the person initiated, recorded with its own consent timestamp |
| `manual` | By the person who created it | Reason must be written in `release_reason` |
A small function can make the rule explicit in code, so that release logic lives in one place instead of being scattered across scripts.
RELEASABLE_WITH_FRESH_OPT_IN = {"sunset", "unsubscribe", "hard_bounce"}
def can_release(reason: str, has_fresh_opt_in: bool) -> bool:
if reason == "complaint":
return False
return reason in RELEASABLE_WITH_FRESH_OPT_IN and has_fresh_opt_in
assert can_release("sunset", True)
assert not can_release("sunset", False)
assert not can_release("complaint", True)When a release does happen, set released_at and release_reason on the existing row, and create the new subscription as a new consent record. Do not reuse the old subscription date, because subscribed_at would make the address look old, and your sunset query would flag it again immediately.
What records to keep, and for how long
Keep three groups of records.
- Consent records. When and how the person opted in: timestamp, source, form or page, IP address if your jurisdiction and policy allow it, and the wording shown at the time.
- Suppression records. The
suppressionstable above, including released rows. - Policy records. Each version of the written sunset policy, with its effective date. A suppression row's
policy_versionshould point to a document you can actually produce.
Set a retention period for each group in writing, and make a scheduled job enforce it. A purge job removes personal data that has outlived its purpose, such as full engagement event history for a long-suppressed subscriber. It should leave the minimal suppression entry in place for as long as you want to guarantee that you will not mail the address again. Retention lengths differ by country and industry. Treat any number you see in an example as a placeholder, and have the right person in your organization set the real one.
Common mistakes
- Using one
statuscolumn for everything. A single column cannot say why or when. Keep the table for history and the column for the current state. - Hard-deleting the subscriber and keeping nothing. The address returns by import and gets mailed.
- Deleting a suppression row to "undo" it. This erases the history. Set
released_atinstead. - Normalizing addresses differently in different systems. A hash mismatch causes silent leakage. Define one normalization and reuse it.
- Forgetting the ESP. Your database may say suppressed while another tool still holds the address on a live list.
- Treating sunset like a bounce. A sunset suppression is recoverable and a hard bounce is not, so the reason field must stay accurate.
Exercise
A subscriber was suppressed for sunset six months ago. Today the same address appears in a trade-show lead spreadsheet that sales wants to import. What should your import process do, and what must be true before the address is mailed again?
Show answer
The import must hash the address, find the active sunset suppression, and block the row instead of adding it to the mailable list. The address can be mailed again only after the person gives fresh consent, such as a new opt-in they initiated. Being on a lead sheet does not count. When that happens, set released_at and release_reason on the existing suppression row, and create a new consent record with its own timestamp so the old subscribed_at does not trigger another sunset immediately.
Exercise
Why does the suppression table store last_engaged_at and reengagement_sent_at as columns instead of calculating them from engagement_events when needed?
Show answer
The event table may be pruned under your retention policy, and its contents can change after the decision, for example if a late event is backfilled. Copying the two values at suppression time preserves the evidence the decision was based on, so you can explain it later even if the source events are gone.