We have one central postfix mailserver and some more application servers behind whereas those servers relaying the mails trough the central mailserver. now i want to configure the central one to rewrite the TO-Field from the original recipient to a generic one like testing@example.com but ONLY from 2 specific application servers, so:
postfix has to check from which applicationserver the mail is coming (either by IP or better by hostnames (FQDN) and if the hostname matches app1.example.com or app2.example.com, then the mail recipient is always testing@example.com.
if the hostnames is not app1 or app2 then the original recipient remains (no rewrite).
i only managed to rewrite all mails TO header but not by sending hostname/ip