OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
adding a header without PREPEND?

From: Louis Munro (louis.munrogmail.com)
Date: Thu May 22 2008 - 10:58:06 CDT


Hi fellow postmasters,
I want to add a header to all mail processed by postfix to be able to
sort it using procmail based on which server received it (this postfix
server is a smarthost). The procmail scripts will be used (and maybe
written) by people who are not familiar with email headers and so I want
to make it as easy as possible for them to match the condition.

I am currently using this:

in main.cf:
smtpd_client_restrictions =
        check_client_access cidr:/etc/postfix/maps/add_headers.cidr

in /etc/postfix/maps/add_headers.cidr:
0.0.0.0/0 PREPEND X-MTA-RECEIVED: server.example.com

Which seems to work well enough, the header is added above the most
recent "Received:" header making it easy to match with procmail.

But I am left wondering if there isn't an easier way to do it.
Is there a way to add a header line that can be configured outside of
the usual access tables? Since this is to be done for all messages I
would ideally like to be able to do it outside of the restrictions if
only to keep them as simple as possible and avoid any possible conflict
between PREPEND, REJECT, DUNNO and so on.

Any ideas? This is for postfix 2.2.10.

Thanks for your help,
Louis