OSEC

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

From: Noel Jones (njonesmegan.vbhcs.org)
Date: Thu May 22 2008 - 13:02:10 CDT


Louis Munro wrote:
> 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
>
>

PREPEND is the action to add a header; the way you are doing
it is fine. And there isn't any other action that adds custom
headers.

It's usually better to add custom headers under
smtpd_data_restrictions - otherwise with multi-recipient mail
you may get one header added for each recipient.

--
Noel Jones