Sub topic 8
Making withdrawal as easy as opting in
This chapter assumes you have read the earlier chapters on valid consent and consent records. You should know what a consent record contains, and you should be able to read short Python and HTTP snippets. This is general education, not legal advice. Check the rules that apply to your audience.
Why withdrawal needs its own design
Getting consent is only half of the relationship. People change their minds, and the law expects you to let them do so without effort. Article 7(3) of the GDPR says it must be as easy to withdraw consent as to give it. If someone joined by ticking one box, they should not need to log in, find a settings page, and write to support to leave.
Poor unsubscribe handling causes problems beyond legal ones:
- Recipients who cannot find the unsubscribe link click "report spam" instead. Mailbox providers read those complaints as a sign of a bad sender, and your deliverability drops.
- Regulators treat ignored opt-outs as a clear violation. Complaints about messages that continue after an opt-out are among the easiest to prove.
- Your consent records become wrong. A record that shows consent but not withdrawal misrepresents the person's current choice.
What each regime requires
The details differ, but the direction is the same.
| Regime | Withdrawal rule | Timing |
|---|---|---|
| GDPR and ePrivacy (EU and UK) | Withdrawal must be as easy as giving consent. Individuals also have an absolute right to object to direct marketing (GDPR Article 21). | Stop without undue delay. Regulators generally expect days, not weeks. |
| CAN-SPAM (US) | Every commercial message needs a clear opt-out mechanism. It can't charge a fee or require more than a reply email or a visit to a single web page. | Honor within 10 business days. The mechanism must work for at least 30 days after sending. |
| CASL (Canada) | Every message needs a working unsubscribe mechanism, using the same electronic means as the message or a link to a web page. | Honor within 10 business days. The mechanism must work for at least 60 days after sending. |
Treat the regulatory deadlines as outer limits. Large mailbox providers set stricter expectations for bulk senders. Gmail and Yahoo, for example, ask for one-click unsubscribe and expect it to be processed within two days. In practice, process an unsubscribe immediately and automatically.
Matching effort: the symmetry test
A practical check is to compare the steps for joining with the steps for leaving.
- Count the clicks and fields needed to subscribe.
- Count the clicks and fields needed to unsubscribe.
- If leaving takes more effort than joining, redesign it.
Common patterns that fail the test:
- The unsubscribe link is in tiny, low-contrast text, or is hidden among other footer links.
- The link leads to a login page, but the person subscribed without creating an account.
- The page asks for the email address again, even though the link already identified the person.
- The flow shows a long survey or several "are you sure?" screens before it finishes.
- Unsubscribing only works by emailing a support address, while subscribing took one checkbox.
A short, optional "why are you leaving?" question is fine if the withdrawal has already taken effect when the page loads. It must never be a barrier.
Building the unsubscribe flow
A good flow has four parts: a visible link, a one-click header, a signed token, and a suppression list.
The visible link and the header
Every marketing message should contain a plain-text link to an unsubscribe page, placed where people expect it, in readable type. In addition, add the List-Unsubscribe header so mail clients can show their own unsubscribe button. For one-click support, RFC 8058 defines a second header, List-Unsubscribe-Post.
List-Unsubscribe: <https://example.com/unsubscribe?e=reader%40example.com&p=monthly_newsletter&t=3f9a0c>, <mailto:[email protected]?subject=unsubscribe>
List-Unsubscribe-Post: List-Unsubscribe=One-ClickWith these headers, the mail client sends an HTTP POST to the URL with the body List-Unsubscribe=One-Click. Your endpoint must process that POST without further interaction. The header only works if the message is DKIM-signed, and the signature must cover both headers.
Signed tokens that do not expire
In the double opt-in chapter, confirmation tokens expired after 48 hours. Unsubscribe tokens should not. Someone may open a two-year-old email and click the link, and it must still work. The token's job is to stop strangers from unsubscribing other people's addresses, not to limit time.
The suppression list
When someone withdraws, do two things:
- Mark the consent record as withdrawn by setting
withdrawn_at. Do not delete the record, because it is your evidence of the history. - Add the address and purpose to a suppression list that every sending system checks before each send.
Without the suppression list, the next import from a CRM, a webinar tool, or a spreadsheet can quietly re-add the person. Keep the suppression entry for as long as you might otherwise re-add the address. It contains the minimum needed to honor the request, which is a lawful reason to retain it. Some teams store only a hash of the address.
The following example uses only the Python standard library. It records a withdrawal and adds a suppression entry in one transaction.
import hashlib
import hmac
import sqlite3
from datetime import datetime, timezone
SECRET_KEY = b"load-this-from-an-environment-variable"
def unsubscribe_token(email: str, purpose: str) -> str:
message = f"unsubscribe|{email}|{purpose}".encode()
return hmac.new(SECRET_KEY, message, hashlib.sha256).hexdigest()
def verify_unsubscribe(email: str, purpose: str, token: str) -> bool:
expected = unsubscribe_token(email, purpose)
return hmac.compare_digest(token, expected)
def withdraw(conn: sqlite3.Connection, email: str, purpose: str, token: str) -> bool:
if not verify_unsubscribe(email, purpose, token):
return False
now = datetime.now(timezone.utc).isoformat()
with conn:
conn.execute(
"UPDATE consent SET withdrawn_at = ? "
"WHERE email = ? AND purpose = ? AND withdrawn_at IS NULL",
(now, email, purpose),
)
conn.execute(
"INSERT OR IGNORE INTO suppression (email, purpose, added_at) "
"VALUES (?, ?, ?)",
(email, purpose, now),
)
return True
def may_send(conn: sqlite3.Connection, email: str, purpose: str) -> bool:
row = conn.execute(
"SELECT 1 FROM suppression WHERE email = ? AND purpose = ?",
(email, purpose),
).fetchone()
return row is None
if __name__ == "__main__":
conn = sqlite3.connect(":memory:")
conn.execute(
"CREATE TABLE consent (email TEXT, purpose TEXT, withdrawn_at TEXT)"
)
conn.execute(
"CREATE TABLE suppression "
"(email TEXT, purpose TEXT, added_at TEXT, PRIMARY KEY (email, purpose))"
)
conn.execute(
"INSERT INTO consent VALUES (?, ?, NULL)",
("[email protected]", "monthly_newsletter"),
)
token = unsubscribe_token("[email protected]", "monthly_newsletter")
print("before:", may_send(conn, "[email protected]", "monthly_newsletter"))
print("bad token:", withdraw(conn, "[email protected]", "monthly_newsletter", "nope"))
print("good token:", withdraw(conn, "[email protected]", "monthly_newsletter", token))
print("after:", may_send(conn, "[email protected]", "monthly_newsletter"))Running it prints before: True, bad token: False, good token: True, and after: False.
The withdrawn_at IS NULL condition keeps the original withdrawal timestamp if the link is clicked twice. The suppression key is (email, purpose), which supports the per-purpose handling described in the preferences chapter.
The overall flow
Edge cases
Replies and informal requests
People often reply "please stop" instead of using the link. Such a message is a valid withdrawal. Train support staff to log it right away, and monitor the reply-to address and the mailto: unsubscribe address. A request that sits in an unread inbox for a month is still a failure to honor it.
Confirmation messages
You may send one final message confirming that the person is unsubscribed. Keep it to a single, purely transactional notice with no promotional content. Many teams show the confirmation on the web page and send nothing at all, which is safer.
Several lists and purposes
If someone is on both a newsletter and a promotions list, the link in a newsletter should make clear what it does. Offer a choice on the landing page, such as "Unsubscribe from this newsletter" or "Unsubscribe from all marketing", but process the narrowest obvious request first. The default action of a one-click request is to stop that specific purpose. A request to stop "all marketing email" must cover every marketing purpose.
Data subject requests
A request to "delete my data" is different from an unsubscribe. If you erase everything, including the suppression entry, you may email the person again later. Keep the minimal suppression record and explain this to the person in your privacy notice.
Third-party tools and processors
Your email service provider, CRM, and any agency that sends for you each hold their own copy of the list. Withdrawal must reach all of them. Give your tools a single source of truth for suppression, or sync the list on every change rather than on a weekly schedule.
Transactional messages
Receipts, password resets, and security alerts are not marketing. Someone who has unsubscribed from marketing can still receive them. Do not slip promotional content into them, because that turns them into marketing email and the opt-out then applies.
Common errors
- Requiring a login. The person never created an account, or forgot the password. Use a signed link instead.
- Treating "delete" as "unsubscribe" and the reverse. Handle them as separate requests with separate effects.
- Re-adding people on import. Check the suppression list before importing anyone.
- Letting tokens expire. Old links must keep working. Under CAN-SPAM and CASL the mechanism must work for 30 and 60 days respectively, but real recipients click much later.
- Batch processing with a long delay. A nightly job is acceptable, but a monthly one is not.
- Putting the link only in an image. Image-blocking clients hide it. Always include a text link.
Review checklist
- Each message has a readable text link and the
List-UnsubscribeandList-Unsubscribe-Postheaders. - The endpoint processes a one-click POST with no extra steps.
- Tokens are signed and do not expire.
- Withdrawal sets
withdrawn_atand writes to a shared suppression list. - Informal requests, such as replies, reach the same process.
- Every sending tool checks suppression before each send, including imports.
- Processing happens within days at most, and ideally immediately.
Exercise
A subscriber clicks the unsubscribe link in an email you sent 18 months ago. Your system has a 48-hour token expiry, so the page shows "This link has expired. Please log in to manage your preferences." The person never created an account. Explain what is wrong and how you would fix it.
Show answer
The flow breaks the rule that withdrawal must be as easy as giving consent. The person joined with a form and no account, but leaving now requires a login. The expiry also makes old emails useless, even though a recipient can reasonably click an old link, and CAN-SPAM and CASL require the mechanism to keep working for at least 30 and 60 days. The fix is to use a signed token that does not expire, as in unsubscribetoken above, which is only meant to prove the request was not forged. The link should process the withdrawal immediately, set withdrawnat on the consent record, and add the address to the suppression list, with no login. Add the List-Unsubscribe-Post header so mail clients can do the same in one click.
Exercise
Why should a withdrawal update the consent record and add a suppression entry, instead of deleting the person's row?
Show answer
Deleting the row removes both the evidence of the consent history and the memory that the person opted out. The next import from a CRM or spreadsheet could then add the address again and you would email someone who has already refused. Keeping the record with a withdrawn_at timestamp preserves proof of what happened, and the suppression entry holds only the minimum data needed to honor the request in future.