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 = regexp:/etc/postfix/list_unsub_header
- 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>"
- Restart Postfix it with
service postfix restart
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 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@example.com
- 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: firstname.lastname@example.org?subject=unsubscribe>
- With the mailto method, you have to manually unsubscribe the users.
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: unsubscribe//www.com?subject=unsubscribe>, <http: