How it works: unsubscribe implementation methods
To implement the opt-out option in your email header, your email server must first be configured. For example, this is how to add the list-unsubscribe header to all outgoing emails using Postfix:
- in /etc/postfix/main.cf, set
header_checks
to:
header_checks = regexp:/etc/postfix/list_unsub_header
Copy
- create a list_unsub_header file in /etc/postfix/ and add the following:
/^Content-Transfer-Encoding:/i PREPEND List-Unsubscribe: mailto:<sender-email-address>?subject=unsubscribe>"
Copy
- Restart Postfix it with
service postfix restart
Copy
or
/etc/init.d/postfix restart
Copy
Contact your email administrator to insert this option for your particular server. If you use an email service provider, you can ask them to insert the list-unsubscribe header into your email. Or you can do this yourself, using the ESP’s documentation. To accomplish this, you will have to choose between two types of unsubscribing methods: mailto and http.
Mailto
Mailto is the most commonly used method for implementing the list-unsubscribe header. When a user clicks the unsubscribe link, the mail client generates an email with an unsubscribe request and sends it to a specified email address. You also need to process the request and unsubscribe from this user. Here is the flow of setting up a mailto list-unsubscribe:
- Create a dedicated email address for unsubscribe requests. For example, [email protected]
- Provide this email address to your email administrator or ESP and ask them to insert it into the email header. The following syntax should be used:
List-Unsubscribe: <mailto: [email protected]?subject=unsubscribe>
Copy
- With the mailto method, you have to manually unsubscribe the users.
Http or unsubscribe URL
With the http method, behind the list-unsubscribe header, there is a URL leading to a web page for opting out. When a user clicks the unsubscribe link, a landing page opens, and the user is asked to confirm unsubscription. Here is the flow of setting up an http list-unsubscribe:
- Create a web page dedicated to unsubscribe requests. Both http: and https: are acceptable. For example, http://www.example.com/unsubscribe.html
- Provide the unsubscribe URL to your email administrator or ESP, and ask them to insert it into the email header. It is best to use this method in conjunction with mailto because the recipient’s inbox client may not support http list-unsubscribe. That’s why it is advisable to use the following syntax:
List-Unsubscribe: <mailto: [email protected]?subject=unsubscribe>, <http://www.example.com/unsubscribe.html>
Copy
- Also, make sure a user does not need to enter credentials or select a checkbox to complete the unsubscription process.
Test
You can test your email by sending an email with the corresponding email on this URL