All our internal machine generated emails are sent through our Postfix server (which is only used for outbound mail), and then relayed out to a third party MTA. To be able to integrate all outbound mail to other services (like CRM), we are adding a few headers (customer number etc) to the mail that is delivered to Postfix.
What I'm trying to achieve is for Postfix to deliver a copy to a local IMAP account, and then remove our internal/private headers before passing the mail on to the relay host. The idea is for some custom software to read the copy from the IMAP account, using the interal/private headers for integration with other systems. Delivering a copy of all mail is easy using the always_bcc option, but adding header_checks, with an IGNORE instruction for our internal headers, removes the headers _before_ the local copy is delivered. In other words: The headers are removed from both our bcc-copy and the one forwarded to the relayhost. I understand this is because the cleanup is done before the delivery, but I don't see how I can configure this to achieve the result I need. Any tips is highly appreciated. :) -- Lars Preben Sørsdahl lars.preben.no