Sub topic 8
Unsubscribe links, headers, and preference centers
What this chapter covers
This chapter assumes you know how email is sent and received, what an email service provider (ESP) does, and what a DNS record is. It also assumes you have read the chapters on consent and on legal basics. You will learn how to give recipients a working way to leave, how to signal that option to mailbox providers with headers, and how to offer something finer than "all or nothing" with a preference center.
Unsubscribe handling is where legal duty, user experience, and deliverability meet. A hidden or broken unsubscribe link does not keep subscribers. It pushes them toward the "Report spam" button, and spam complaints hurt your sending reputation far more than an unsubscribe does.
Why unsubscribe handling matters
Recipients have three ways to stop receiving your mail:
- Click your unsubscribe link.
- Use the unsubscribe button that the mail client shows, which depends on your headers.
- Mark the message as spam.
Only the first two are visible to you as clean opt-outs. A complaint tells the mailbox provider that you sent something unwanted, and it counts against your domain and IP reputation. Your goal is to make options 1 and 2 easier than option 3.
The rules differ by message type:
| Message type | Unsubscribe link in body | List-Unsubscribe header | Notes |
|---|---|---|---|
| Newsletter | Required in practice, and legally required in most regions | Strongly recommended | Recurring, so recipients need an easy exit |
| Promotional email | Required | Required by major mailbox providers for bulk senders | Mailbox provider rules apply to high-volume senders |
| Transactional email | Not required for a purely transactional message | Not normally used | Do not add promotional content, or the message may need one |
The last row connects to the chapter on mixed-content messages. If a receipt or password reset contains a promotion, you may be treating it as marketing, and then the marketing rules apply.
The unsubscribe link in the message body
The visible link is the foundation. Follow these rules:
- Put it where people can find it, usually in the footer, in readable text and a readable size.
- Label it plainly, for example "Unsubscribe". Avoid wording like "Manage your communication journey".
- Make it work without a login. Requiring a password to opt out is a common cause of complaints and a legal problem in several regions.
- Keep the process short. One click to a confirmation page, or one click that completes the opt-out, is the best pattern. Do not ask people to explain why they are leaving before the opt-out takes effect. An optional survey after the opt-out is fine.
- Use a unique, unguessable token per recipient in the URL, so that the link identifies the subscriber without exposing the address in plain text and so that nobody can unsubscribe other people by changing a number in the URL.
Processing time
Honor requests quickly. CAN-SPAM in the United States allows up to 10 business days, but treat that as a ceiling, not a target. Most ESPs process opt-outs immediately, and recipients who receive another message a day later are likely to complain. Under GDPR, withdrawing consent should be as easy as giving it, and processing should follow without undue delay.
Suppression, not deletion
When someone unsubscribes, do not delete the record. Add the address to a suppression list, a list of addresses that you must never send marketing mail to. If you delete the address, a later import, a form submission by someone else, or a sync from your CRM can add the address again and you will email someone who opted out. Keep the address, the date, the source of the opt-out, and the scope of the opt-out (all marketing, or one list).
The List-Unsubscribe header
Mail clients such as Gmail and Apple Mail can show their own "Unsubscribe" button near the sender name. They do this when the message carries a List-Unsubscribe header (defined in RFC 2369). The header contains one or more targets in angle brackets, either an HTTPS URL or a mailto: address.
One-click unsubscribe
A plain List-Unsubscribe URL might open a web page that asks for confirmation. RFC 8058 adds a one-click mechanism. When you add a second header, List-Unsubscribe-Post: List-Unsubscribe=One-Click, the mail client sends an HTTP POST request to your URL, and your server removes the recipient without further interaction.
From: Example Weekly <[email protected]>
To: [email protected]
Subject: This week at Example: three guides worth your time
List-Unsubscribe: <https://example.com/unsubscribe/abc123>, <mailto:[email protected]?subject=unsubscribe>
List-Unsubscribe-Post: List-Unsubscribe=One-ClickRequirements for the one-click form:
- The URL must be HTTPS.
- The message must be signed with DKIM, and the signature must cover both the
List-UnsubscribeandList-Unsubscribe-Postheaders. See the chapter on authentication. - Your server must accept a POST with the body
List-Unsubscribe=One-Clickand act on it without requiring cookies, a login, or a redirect to a confirmation page. - The token in the URL identifies the recipient, because the POST itself carries no other identity.
Since 2024, Gmail and Yahoo have required bulk senders (Gmail's threshold is about 5,000 messages a day to its users) to support one-click unsubscribe for marketing and subscribed mail, and to honor requests within two days. Check the current provider documentation, because thresholds and wording change.
A minimal one-click endpoint
The following Flask handler shows the shape of the server side. It accepts the POST sent by the mail client, and it also handles a browser GET, which shows a confirmation page for people who click the visible link.
from flask import Flask, request, abort
app = Flask(__name__)
# In production, look tokens up in a database.
TOKENS = {"abc123": "[email protected]"}
SUPPRESSED = set()
@app.route("/unsubscribe/<token>", methods=["GET", "POST"])
def unsubscribe(token):
address = TOKENS.get(token)
if address is None:
abort(404)
if request.method == "POST":
# Mail clients send: List-Unsubscribe=One-Click
# Browser form submissions use the same handler.
SUPPRESSED.add(address)
return "You have been unsubscribed.", 200
# GET: show a confirmation page, do not change state.
return (
"<form method='post'>"
"<p>Unsubscribe from Example Weekly?</p>"
"<button type='submit'>Confirm</button>"
"</form>"
)
if __name__ == "__main__":
app.run(port=5000)Notice that GET does not change state. Some corporate security scanners and link prefetchers open every URL in an email. If a GET request unsubscribed people, these tools would silently remove real subscribers. This is the main reason one-click unsubscribe uses POST.
Common header mistakes
- Adding
List-Unsubscribe-Postwithout DKIM-signing it, which makes mail clients ignore the one-click option. - Pointing the header at a URL that returns a redirect or requires a login.
- Handling the opt-out in a nightly batch job, so the recipient keeps receiving mail for another day.
- Using a
mailto:target whose mailbox nobody monitors or processes. - Adding the header to transactional mail, where an unsubscribe button invites people to turn off password resets.
Preference centers
A preference center is a web page where subscribers choose what they receive and how often. It gives people an option between staying on everything and leaving entirely.
A good preference center offers:
- Separate topics or lists, for example "Weekly newsletter", "Product announcements", "Sales and offers".
- Frequency choices, such as weekly digest instead of every message.
- A clear "Unsubscribe from all marketing" option.
- A statement that transactional messages (receipts, security notices) will continue, because they are not marketing.
Design rules:
- Open it without a login, using the same per-recipient token as the unsubscribe link.
- Show the current choices pre-filled, so people can change one thing and save.
- Confirm the change on the page, and optionally by email.
- Keep the unsubscribe-from-all option visible and not buried beneath the other options.
Where the preference center fits
The preference center does not replace the one-click link. A strict reading of the rules requires that people can opt out of all marketing messages easily. If your unsubscribe link only takes people to a page of twelve checkboxes, you risk regulatory trouble and complaints. A common pattern is:
- The
List-Unsubscribeheader and one-click POST remove the recipient from the list that sent the message, or from all marketing. - The footer link goes to a page that confirms the opt-out and offers "Manage preferences" as a second step.
Scope: which list does an opt-out apply to?
A frequent source of errors is unclear scope. Decide and document the answer before you build.
- Per-list opt-out. The person leaves the newsletter but still receives promotions. This is fine only if the page makes the scope clear and offers a way to leave everything.
- Global marketing opt-out. The person leaves every marketing stream. This is the safest default for the one-click header.
- Transactional messages. These continue after a marketing opt-out because they serve a specific user action. If a customer cancels their account, stop sending even these once they are no longer needed.
Under CAN-SPAM, an opt-out request applies to the sender's commercial messages, and you may not charge a fee or require more than an email reply or a visit to a single web page. Under GDPR and ePrivacy, a recipient who withdraws consent or objects to direct marketing must stop receiving it. The legal basics chapter covers these in detail. When in doubt, treat an unsubscribe as global for marketing.
Shared systems and multiple brands
If several teams or brands send from one ESP account, a suppression list that lives in only one tool will not protect the recipient. Sync opt-outs across your marketing platform, CRM, and any in-house senders. Check suppression at send time, not only when you build a segment, because a person may opt out between the two.
Testing your setup
Before launch, verify each of these:
- Send a test to Gmail and another provider, and confirm the "Unsubscribe" button appears beside the sender name.
- Inspect the raw message headers and confirm both
List-UnsubscribeandList-Unsubscribe-Postare present and covered by the DKIM signature. - Use
curlto simulate the mail client's POST and check that the response is a 200 and that the address is suppressed. - Open the footer link in a private browser window with no cookies.
- Open the link on a phone, because many recipients read on mobile.
- Confirm that a second send to a suppressed address is blocked.
curl -X POST \
-d "List-Unsubscribe=One-Click" \
https://example.com/unsubscribe/abc123Edge cases
- Forwarded messages. A recipient who forwards a newsletter exposes their unsubscribe token. Anyone with the forwarded copy can unsubscribe them. This is a known trade-off of tokenized links, and it is usually acceptable because the damage is limited to a lost subscription.
- Role addresses and shared inboxes. One person unsubscribing from a shared address removes it for everyone who uses it.
- Re-subscription. If someone opts back in through a signup form, record fresh consent, and do not silently reactivate old records that were suppressed.
- Unsubscribe by reply. People often reply "stop". Monitor replies, or use an inbound handler that detects opt-out phrases, and apply them as opt-outs.
- Multiple languages. Write the link and the page in the recipient's language.
Summary
- The visible unsubscribe link, the
List-Unsubscribeheader with one-click POST, and a preference center each do a different job, and a good program uses all three. - One-click unsubscribe needs HTTPS, DKIM signing of both headers, and a server that acts on a POST with no login.
- Keep suppressed addresses on a suppression list, check it at send time, and sync it across every system that sends.
- A preference center offers topics and frequency, but it must never hide the option to leave entirely.
- Purely transactional messages do not carry an unsubscribe header, and adding marketing content to them changes how they are treated.
Exercise
Your server handles List-Unsubscribe links with a GET request that immediately removes the subscriber. Within a week, several people complain they were unsubscribed without clicking anything. What is the likely cause, and what change fixes it?
Show answer
Email security scanners and link prefetchers open every URL in a message, so the GET request triggered the opt-out. Change the handler so that a GET shows a confirmation page without changing state, and only a POST (as in RFC 8058 one-click unsubscribe, with the body List-Unsubscribe=One-Click) performs the unsubscribe.
Exercise
A marketing email contains the header List-Unsubscribe-Post: List-Unsubscribe=One-Click, but Gmail does not show an unsubscribe button. Name three things you would check.
Show answer
Check that the List-Unsubscribe URL uses HTTPS, that the message is DKIM-signed with a signature that covers both the List-Unsubscribe and List-Unsubscribe-Post headers, and that SPF, DKIM, and DMARC align for the sending domain. You can also check that the endpoint accepts the POST without a login or redirect, and that the sender meets the provider's reputation and volume requirements.
Exercise
A subscriber opens your preference center and unticks "Sales and offers" but leaves "Weekly newsletter" ticked. Two days later they click the one-click unsubscribe button in the newsletter. What should happen to their record, and why should you store the address instead of deleting it?
Show answer
The one-click request is a clear request to stop, so the safest handling is to add the address to the marketing suppression list for all marketing streams, and to make the scope clear on the confirmation. Store the address, date, source, and scope, because deleting it would let a later import or sync add the person again and you would email someone who opted out.