OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
How to rewrite headers on a per-destination basis

From: Alex Bligh (alexalex.org.uk)
Date: Mon Nov 05 2007 - 05:58:23 CST


I want to be able to rewrite headers on a per-destination SMTP basis, e.g.
for mail to example.com or example.net I want to remove the X-Remove-This:
header, and (if not already present) add an X-Add-This: header. How do I do
this on postfix (presumably using header_check, but I can't see an obvious
way to make this per destination or only add headers if they aren't already
there).

On exim I would do something like:

dnslookup_example:
   driver = dnslookup
   domains = example.com:example.net
   transport = remote_smtp
   headers_remove = X-Remove-This
   headers_add = ${if !def:h_X-Add-This:{X-Add-This: Test}}

Apologies if this is obvious.

Alex