Postfix: How to prepend a header only once

emailpostfixsmtp-headers

I want to prepend a header with postfix to every outgoing mail from a specific domain. At the moment i use:

check_sender_access hash:/etc/postfix/prepend

with /etc/postfix/prepend:

my.domain PREPEND Header: value

this works quite nice, but when i send a e-mail to several recipients, then the header is added multiple times, one for each recipient, to each of the outgoing mails.

so when i send a mail to 4 persons, each of them receives a mail, which contains the header 4 times.

Best Answer

There is no "simple" solution for this. You need to define a second smtpd instance in master.cf, have it access it's own cleanup instance, and define a header_checks maps for this cleanup instance. Then, you'd prepend the header on some unique header present in that mail, i.e. message-id.

Related Topic