Im setting up postfix SMTP relay, that will be placed right after Exchange server.

Details: 1) postfix server name mail.server.com 2) we have several domains: a-domain.com, b-domain.com and etc..

I need to rewrite somehow emails headers. So recipient will not receive email like:

Received: from mail.server.com ([XX.XX.XX.X])

But will receive it from mail.a-domain.com ([XX.XX.XX.X]) if sender is user@a-domain.com OR from mail.b-domain.com ([XX.XX.XX.X]) if sender is user@b-domain.com

is this possible anyhow?


Postfix does not support directly this feature, but you can fiddle with transport maps in order to achieve your goal.

You can add many transports in master.cf, each for every domain, with a -o directive that adds a remap rule

In the transport file you set up the transport rule to use the transports specified in master.cf accordinf to the domain name

This blog post contains some examples and some links.

  • Thank you. Seems this is what i need exactly. I'll just create bunch of email gateways (for each domain) and strip the headers – Shirker Nov 16 '14 at 7:59
  • finally I found this link tekman.livejournal.com/83609.html sender_dependent_relayhost_maps = hash:/etc/postfix/sender_dependent_relayhost works for me (as on my testing) – Shirker Nov 19 '14 at 18:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.