esackbauer

Firstly this file location I think is incorrect: header_checks = regexp:/etc/postfix/list_unsub_header
And secondly don’t want to add header for only one email but for all mailboxes registered on specific domains: List-Unsubscribe: <mailto: unsubscribe@example.com?subject=unsubscribe>

    eakteam Firstly this file location I think is incorrect:

    You need to understand that postfix is containerized and where the actual config files are saved. That is in /opt/mailcow-dockerized/data/conf/postfix or similar folder, depending on your OS.
    You will find more info in the mailcow documentation.

    eakteam don’t want to add header for only one email

    Why do you think its only for one mailbox?
    The only thing you have to figure out is how to do it for each domain separately, and that can be found somewhere in the postfix documentation itself

      esackbauer

      esackbauer That is in /opt/mailcow-dockerized/data/conf/postfix or similar folder, depending on your OS.

      So, you are saying that we should use that directory or just /data/conf/postfix? Also I can see on original mailcow postfix config (main.cf) that some files are pointed to different dir e.g. virtual_mailbox_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_mailbox_maps.cf

      This is confusing, that’s why asking a tested version for that.

      esackbauer Why do you think its only for one mailbox?
      The only thing you have to figure out is how to do it for each domain separately, and that can be found somewhere in the postfix documentation itself

      This is why i need help, on how to do that in an easy way globally or for each domain but can’t find documentation on mailcow nor postfix.

      If there is any working template/example how to achieve that it would be awesome.

      Exactly! I am having the same issue, I want to add a global List-Unsubscibe header and I followed the mentioned Mailtrap Icon tutorial

      , but still not working.
      There is a confusion about how to do this correctly, one of which is which main.cf should be edited? the one in system’s /etc/postfix/ or the one in the mailcow working directory which is in my case /home/mailcow-dockerized/data/conf/postfix/, i tried both and none worked, also when i change the main.cf in /home/mailcow-dockerized/data/conf/postfix and i restart postfix-mailcow process, the main.cf gets back to previous state..
      I would really appreciate if someone could give an explicit step by step guide to us newbies, its just too confusing.. 🙁 !

      Do not just reboot, do docker compose up -d !!

        esackbauer
        I tried and nothing still.. 😕

        What i literally tried is:

        1. added new line header_checks = regexp:/etc/postfix/list_unsub_header to /home/mailcow-dockerized/data/conf/postfix/main.cf
        2. created list_unsub_header next to main.cf in /home/mailcow-dockerized/data/conf/postfix/list_unsub_header
        3. ran docker compose up -d
        4. restarted postfix-mailcow form mailcow UI

        Please where did I mess up? I have been trying this for days.. 🙏

          DocFraggle
          I tried running docker compose down then docker compose up -d but nothing.
          Also the header_checks line that was added in the /home/mailcow-dockerized/data/conf/postfix/main.cf disappeared

            Olgaa
            I guess you want this for Incoming messages!
            in your case create the file:
            /home/mailcow-dockerized/data/conf/postfix/list_unsub_header

            add to:
            /home/mailcow-dockerized/data/conf/postfix/extra.cf
            header_checks = regexp:/opt/postfix/conf/list_unsub_header

            run:
            docker compose up -d
            docker compose restart postfix-mailcow

            although i have no clue how this will work in a multidomain setup just for one domain.

              piperino
              I tried the steps and nothing yet! 🤔 does it take some time to work ?

                Olgaa
                actually no. Header was there immediately there on incoming messages.
                You have checked the message source. right?

                Yes, the List-Unsubscribe header is missing :/
                By the way this is the contents of /home/mailcow-dockerized/data/conf/postfix/list_unsub_header

                /^Content-Transfer-Encoding:/i PREPEND List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"

                which I got from Mailtrap Icon here

                , is it correct?

                i used exactly the same manual
                the only difference is the path in the extra.cf

                what is the output from:
                docker-compose exec postfix-mailcow postconf -n | grep -i header

                run below and post the output if something found
                docker-compose logs postfix-mailcow | grep prepend

                  I did a little bit more of fiddling around. So please read the below carefully.
                  The example I’ve explained earlier just works with incoming mails. As I already wrote.
                  E.g. from gmail to mailcow!

                  1. In postfix you have to differentiate SMTP”D” and SMTP. The “D” is responsible for incoming mails. So, what you
                    need is “smtp_header_checks =” in extra.cf for outgoing a assume.
                  2. BUT “smtp_header_checks” is already configured per default and is using “anonymize_headers.pcre”
                  3. You can either completely override “anonymize_headers.pcre” by setting smtp_header_checks =
                    regexp:/opt/postfix/conf/list_unsub_header in “extra.cf”, what I’ve done for testing, or try to add the content of
                    your “list_unsub_header” at the bottom of “anonymize_headers.pcre” (should work)
                  4. There are two issues with the above. “anonymize_headers.pcre” might be overwritten with an update, or you might
                    having obsolete content in “list_unsub_header” if the content changes in
                    “anonymize_headers.pcre”
                  5. And the last point is, create your regex so that it’ll will match. Check in recipient’s mailbox for an existing header field. As example, if you send a mail from SoGo with no attachment there there is no “Content-Transfer-Encoding” in the header.

                  Final Word:
                  You might want to look around for another solution to run newsletter or a mailinglist rather than using mailcow, since it is some sort of closed solution.
                  Even though I haven’t found one use case yet which is not covered by mailcow for running a regular, very well designed “mail appliance”.
                  Over and out.

                  maybe @DocFraggle or @esackbauer you can give a few words since you seem to have a lot of experience with mailcow

                  piperino
                  docker-compose exec postfix-mailcow postconf -n | grep -i header gives me:

                  header_checks = regexp:/opt/postfix/conf/list_unsub_header
                  smtp_header_checks = pcre:/opt/postfix/conf/anonymize_headers.pcre
                  smtpd_sasl_authenticated_header = yes
                  smtpd_tls_received_header = yes

                  and

                  docker-compose logs postfix-mailcow | grep prepend gives:

                  postfix-mailcow-1  | Feb 27 21:58:44 442c313eb6bb postfix/cleanup[483]: 75E6B13C1B04: prepend: header Content-Type: text/html; charset=utf-8 from mail-qt1-f181.google.com[209.85.160.181]; from=<anupam.convodigital@gmail.com> to=<contact@mydomain.com> proto=ESMTP helo=<mail-qt1-f181.google.com>: List-Unsubscribe: mailto:unsubscribe@mydomain.com?subject=unsubscribe
                  postfix-mailcow-1  | Feb 27 22:16:21 442c313eb6bb postfix/cleanup[483]: 834C613C0A61: prepend: header Content-Transfer-Encoding: quoted-printable from mail-pf1-f171.google.com[209.85.210.171]; from=<madison@teamrisems.com> to=<updates@mydomain.com> proto=ESMTP helo=<mail-pf1-f171.google.com>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 27 22:26:51 442c313eb6bb postfix/cleanup[602]: D1A8513C1A2C: prepend: header Content-Transfer-Encoding: quoted-printable from mail-yb1-f174.google.com[209.85.219.174]; from=<team@dobleskemarketing.com> to=<news@mydomain.com> proto=ESMTP helo=<mail-yb1-f174.google.com>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 27 22:27:45 442c313eb6bb postfix/cleanup[602]: 1366613C1A4F: prepend: header Content-Transfer-Encoding: 7bit from mail176.acems1.com[192.92.97.176]; from=<bounce-3156164-132-221260-contact=mydomain.com@mail172.acems1.com> to=<contact@mydomain.com> proto=ESMTP helo=<mail176.acems1.com>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 27 22:27:45 442c313eb6bb postfix/cleanup[602]: 1366613C1A4F: prepend: header Content-Transfer-Encoding: quoted-printable from mail176.acems1.com[192.92.97.176]; from=<bounce-3156164-132-221260-contact=mydomain.com@mail172.acems1.com> to=<contact@mydomain.com> proto=ESMTP helo=<mail176.acems1.com>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 27 22:44:04 442c313eb6bb postfix/cleanup[794]: 695B713C18EF: prepend: header Content-Transfer-Encoding: quoted-printable from mout.kundenserver.de[217.72.192.74]; from=<nayef@hellosugarsmile.de> to=<contact@mydomain.com> proto=ESMTP helo=<mout.kundenserver.de>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 27 23:48:34 442c313eb6bb postfix/cleanup[1501]: 9848313C0079: prepend: header Content-Transfer-Encoding: quoted-printable from mail-io1-f54.google.com[209.85.166.54]; from=<ashfaque@theideaforges.com> to=<updates@mydomain.com> proto=ESMTP helo=<mail-io1-f54.google.com>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 27 23:58:54 442c313eb6bb postfix/cleanup[1659]: D903F13C18D6: prepend: header Content-Transfer-Encoding: quoted-printable from mout.perfora.net[74.208.4.197]; from=<peytonriley@infinitumsolar.info> to=<contact@mydomain.com> proto=ESMTP helo=<mout.perfora.net>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 28 00:02:40 442c313eb6bb postfix/cleanup[1729]: 7C56A13C1ABD: prepend: header Content-Transfer-Encoding: quoted-printable from mail-qk1-f172.google.com[209.85.222.172]; from=<anupam.convodigital@gmail.com> to=<contact@mydomain.com> proto=ESMTP helo=<mail-qk1-f172.google.com>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 28 00:17:44 442c313eb6bb postfix/cleanup[1862]: C340313C17F6: prepend: header Content-Transfer-Encoding: quoted-printable from mout.kundenserver.de[212.227.126.133]; from=<simon@marketingfilmsmedia.info> to=<updates@mydomain.com> proto=ESMTP helo=<mout.kundenserver.de>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"
                  postfix-mailcow-1  | Feb 28 08:41:47 442c313eb6bb postfix/cleanup[6307]: 3EE2A13C1BC1: prepend: header Content-Transfer-Encoding: quoted-printable from mta-07-3.privateemail.com[198.54.118.214]; from=<samuel@bestpldomains.com> to=<updates@mydomain.com> proto=ESMTP helo=<MTA-07-3.privateemail.com>: List-Unsubscribe: mailto:<unsubscribe@mydomain.com>?subject=unsubscribe>"

                  [unknown] Aha! I thought it was for outgoing emails, like when you send an email from mailcow and it shows to the recipient an “unsubscribe” button 😅

                  [unknown]
                  Adding line /^Content-Type:/i PREPEND List-Unsubscribe: <mailto:unsubscribe@mydomain.com> straight to anonymize_headers.pcre then running docker compose up -d and docker compose restart postfix-mailcow fixes it! 🫣
                  Now there is an List-Unsubscribe header in the source! As you said it might be overwritten after an update but at least it works for now until there is a better solution! Thank you!!! 🙏

                    I would also strongly suggest to outsource these kind of things into a separate solution which also allows better management. Especially in EU with GDPR it is easier to document in case of audits or complaints. In bigger companies this is typically done within CRM, but there is also a free open source solution:
                    listmonk.app Icon listmonk - Free and open source self-hosted newsletter, mailing list manager, and transactional mails


                    Havent tried it yet, but looks decent.

                    a month later

                    Olgaa

                    Any idea how to do that globally? I mean in my case there are a lot of domains which needed the same solution.

                    15 days later

                    Hi fellow bovine enthusiasts. Given the timing, it may be safe to assume you are/were researching this “List-Unsubscribe” configuration to satiate new deliverability requirements from the “big 3”. Just wanted to add a few things:

                    1. Gmail expects a “one-click” unsub; not the mailto: option you’re looking into. This is to facilitate straightforward/automated list removal for their users.
                    2. Make sure you understand that, by adding a “List-Unsubscribe” header (regardless of configuration) you’re essentially signaling your intention to send bulk email. This may have unintended consequences–particularly if your “List-Unsubscribe” is misconfigured, inoperable, or otherwise fails to meet Goog’s expectations.
                    3. Further to the above, what Goog does with the (possible fact) that you include “List-Unsubscribe” headers, yet _do not send bulk email (5,000/day by their definition
                      support.google.com
                      Email sender guidelines - Google Workspace Admin Help
                      The guidelines in this article can help you successfully send and deliver email to personal Gmail accounts. Starting in 2024, email senders must meet the requirements described here to send email to G
                      support.google.com
                      ) is an exercise left to speculation and/or trial & error involving significant downside.

                    As for us, we plan to hold off on adding these headers to Postfix for now, as our server is strictly used for transactional email.

                    Cheers!

                    No one is typing