Score:1

Using List-Unsubscribe headers in emails in Postfix Mail Sever

gn flag

Please guide me to to add List-Unsubscribe header in email in postfix mail server. I tried doing that in linux server. But the List-Unsubscribe header is not showing when I sent mails. When I restarted the postfix server after adding, no change in the header.

I added the following in/etc/postfix/main.cf : header_checks = regexp:/etc/postfix/list_unsub_header

Then I created a list_unsub_header file in /etc/postfix/ and added the following: /^Content-Transfer-Encoding:/i PREPEND List-Unsubscribe: mailto:<sender-email-address>?subject=unsubscribe>"

After that, I restarted the postfix service. Still no change took place.

My Ubuntu version is 22.04.1

Score:1
bz flag

I was finally able to get the unsubscribe-header working in Postfix using

header_checks = regexp:/etc/postfix/list_unsub_header to main.cf

and

/^Content-Type:/i PREPEND List-Unsubscribe: <mailto:unsubscribe@mydomain.com> to /etc/postfix/list_unsub_header

proof

Score:1
us flag

Your configuration looks right in general, but it could be that the mail, which you are sending, does not contain a Content-Transfer-Encoding header. Thus, the regex won't match and no List-Unsubscribe header would be added.

You can fix this by matching against the Content-Type header instead, which should be included in almost all mails. Also the content of the List-Unsubscribe header needs some fixing, since it is not a valid mailto: URL right now.

A working example of /etc/postfix/list_unsub_header could look like this:

/^Content-Type:/i PREPEND List-Unsubscribe: mailto:user@example.com?subject=unsubscribe

Don't forget to replace the email-address in the line with your own ;)

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.