List-Unsubscribe is an email header that tells the mailbox provider where a recipient can opt out of your messages, and one-click unsubscribe is the extension, defined in RFC 8058, that lets the provider unsubscribe the person with a single automated HTTPS request. Gmail and Yahoo show an Unsubscribe button next to the sender name when the headers are present and correct. Bulk senders to those providers are required to add them to promotional mail.
This guide shows what the headers look like, how to sign them, and how to build the endpoint that handles the request.
The List-Unsubscribe header was defined in RFC 2369. It holds one or more URIs, each in angle brackets, that point to a way to leave the list. The mail client reads the header and offers an Unsubscribe button, which is often easier for the user than finding a link in the body.
Without the header, a person who wants to leave looks for the link at the bottom of your message. If they cannot find it, many press Report spam instead, which hurts your sender reputation. A visible button gives them a safe exit.
The header can contain a mailto: address, an HTTPS address, or both:
When only the HTTPS URL is given without the one-click header, the client would open it in a browser, and the user would have to confirm on a web page.
RFC 8058 adds a second header that tells the provider it may send an automated POST request to your HTTPS URL, without showing a page to the user:
The flow is:
List-Unsubscribe=One-Click.The rules that make it valid:
| Rule | Reason |
|---|---|
| The URL must use HTTPS | The request must not be intercepted or changed |
| Both headers must be covered by a DKIM signature | The provider must be sure the headers came from you |
| One URL per message and per recipient | The request carries no other data, so the URL must identify the person |
| The endpoint must work with POST and without a login | The provider is not a logged-in user |
| Honour the request quickly | Google and Yahoo ask for processing within two days |
Because the POST carries no cookie or form data, put a signed token in the URL that identifies the recipient and the list.
Here is a small Flask example for Python 3.13 with Flask 3. It accepts the POST from the mailbox provider, checks a signed token and records the opt-out.
To create the token while building each message:
Points to notice:
You can still provide a normal GET page for people who click the visible link in the body, with a confirmation button.
Add both headers when you build the message. In Python's standard library:
Then make sure your DKIM signer includes List-Unsubscribe and List-Unsubscribe-Post in its list of signed headers. If your email service provider sends the mail, check its settings. Most major providers add and sign these headers for you when you turn the option on.
Test it by sending to a Gmail account and checking the original message source. Look for the DKIM result to be PASS and for the Unsubscribe link next to the sender name.
No. The body link is read by the person in the message, and the header is read by the mail client. Google and Yahoo ask for both: a header and a visible link in the body.
Messages the user asked for in a transaction, such as a password reset, are not expected to have one. Promotional and subscribed messages are.
For one-click unsubscribe you need the HTTPS URL and the List-Unsubscribe-Post header. A mailto: address alone is the older method and does not meet the Gmail and Yahoo requirement.
Fewer unengaged recipients means a lower complaint rate and better placement. A clean exit is better than a spam report.
List-Unsubscribe gives mail clients a button for leaving your list, and List-Unsubscribe-Post with the one-click value lets the provider unsubscribe the person with an automated HTTPS POST. Use an HTTPS URL with a signed token, sign both headers with DKIM, handle the POST without a login, and process the request quickly. Done correctly, it reduces complaints and satisfies the Gmail and Yahoo bulk sender rules.