| 1 | -- Email suppressions (mail/suppression.ts): addresses Diffinery no longer sends any email to, because |
| 2 | -- mail to them bounced for good, their owner reported an email as spam, or a site administrator added |
| 3 | -- them. Every send checks this list first. One row per address; a newer event replaces the row. |
| 4 | CREATE TABLE IF NOT EXISTS email_suppressions ( |
| 5 | email TEXT PRIMARY KEY, -- lower case |
| 6 | reason TEXT NOT NULL CHECK (reason IN ('hard-bounce', 'complaint', 'manual')), |
| 7 | detail TEXT, -- the provider's words (an SMTP reply) or the administrator's note |
| 8 | source TEXT NOT NULL, -- 'cloudflare' (Event Subscriptions queue), 'webhook' (signed intake) or 'admin' |
| 9 | created_by TEXT, -- the administrator's login, for manual ones |
| 10 | created_at TEXT NOT NULL |
| 11 | ); |
| 12 | CREATE INDEX IF NOT EXISTS email_suppressions_at ON email_suppressions(created_at); |