Tomasz Chmielewski wrote:
I would like to add custom headers to outgoing messages only:
X-Custom: my-header
I tried that with:
smtpd_data_restrictions =
check_client_access cidr:/etc/postfix/add_headers/header
and the content of that file:
127.0.0.1 PREPEND X-Custom: my-header
But it gets appended to both incoming and outgoing mail - I use
amavisd-new and dkimproxy with Postfix, so at some point, all mail look
like it was received locally.
I also tried with "check_sender_access pcre:...", but with similar results.
FILTER_README gave me no good clues either.
Anyone there adding custom headers in Postfix?
Use smtp_header_checks, defined in master.cf on the "smtp"
service. Requires postfix 2.5 or newer.
http://www.postfix.org/postconf.5.html#smtp_header_checks
# master.cf
smtp unix - - n - - smtp
-o smtp_header_checks=regexp:/path/add_my_header
# add_my_header
/^/ PREPEND X-Custom: my header
-- Noel Jones