Add "List-Unsubscribe" header in Exim config

Hi,

For anti-spam settings, I’m trying to find out how to add the “List-Unsubscribe” header in Exim config.

I’ve been looking in Internet and in Exim.org site but haven’t found yet a tutorial…

Anyone knows how to do it?

Thanks for any advice.

Best regards,
Roberto Jobet

Any idea?

Thanks

Best regards

Can’t find anything about it when you google it in combination with exim - so probaly no, you will not get an answer here :slight_smile:.

1 Like

Extra headers like ‘List-Unsubscribe’ is not a function of the email server (exim4) but of the sending software. Ex: See php mail function here or PHPMailer library here

1 Like

Hi @Lupu,

Thanks for your feedback!

As far as I know ‘List-Unsubscribe’ header should be set on the server.

Before Exim I was using Postfix, and it’s quite easy to setup: see here in " How it works: unsubscribe implementation methods" (https://blog.mailtrap.io/list-unsubscribe-header/)

Furthermore I’ve found an old post about Exim… https://saeedrahhal.wordpress.com/tag/exim/ where the author says to setup the “headers_add” directive in Exim’s config file (but unfortunately Exim has several config files…)

Best regards,
Roberto Jobet

You can add headers in Exim, but you shouldn’t use that for unsub links. Wrong tool for the job.

2 Likes

I know this is a few years late :sweat_smile: , I’ve just been trying to work out the same thing without much luck online. I’ve found adding a filter at the end of /etc/exim4/system.filter works perfectly, see below:

# Add List-Unsubscribe header if not already present

if "${if def:h_List-Unsubscribe {no}{yes}}" is "yes"
then
  headers add "List-Unsubscribe: <mailto:[email protected]>"
endif

Email went through fine and provides this in the header:

From: John Smith <[email protected]>
To: Ben Dover <[email protected]>
Message-ID: <[email protected]>
Thread-Topic: Testing
Content-type: multipart/alternative;
boundary="B_3835808920_2341711511"
List-Unsubscribe: <mailto:[email protected]>

It may not be how it’s meant to be done, but it works.

This adds the header to every email we use in HestiaCP, correct?

How to add that header only for specific email adresses which are used for newsletter & co?