Is it possible to have some kind of regex match and replace, like it is possible for outgoing mails for incoming, too? I am already able to replace the from field for outgoings, by using the smtp_generic_maps option. Now I'd like to apply the same to incoming mail's to field. But if possible in a richer sense. If mail comes from my own domain I do not want to rewrite the to field. Is it coming from another domain, rewrite it. And thus e.g. redirect it to another address within my domain.
Example:
Assuming my domain is company.com
Now we can separate incoming mail into two categories: Mail from within my domain and mail from outside my domain.
For the first category, postfix should process as usual and no rewriting should take place.
But mail for the second category, i.e. mails from test@gmail.com
should be directed to the central mail account mail@company.com
even if the original recipient was employeeA@company.com
.
By doing this, I still allow email communication among the addresses of my employees but hide them from the outer world.