Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We currently have postfix handling emails generated by a number of apps. A number of these emails are destined for users inside the organisation, whose mail is on an Exchange server in the same site as the postfix box.

I'm looking for a way to do this, but my Google-fu is letting me down:

If the recipient domain is one of our domains, deliver the mail to host All other mail is delivered by looking up the MX record/s and processing normally.

Edit: to clarify, the apps generating the emails are sending to users outside of our organisation too, postfix is not receiving mail at all.

share|improve this question
up vote 6 down vote accepted

Instructions work for Ubuntu, you may need to adjust for other distros.

Add the following to /etc/postfix/

relay_domains =,
transport_maps = hash:/etc/postfix/transport

Create the file /etc/postfix/transport:  smtp:[]  smtp:[]

Run these commands:

$ sudo postmap /etc/postfix/transport
$ sudo /etc/init.d/postfix reload
share|improve this answer looks promising

share|improve this answer
I'm reading that right now. I also have a headache right now and I'm reasonably certain that's not a coincidence. :-) Was hoping someone had a quick answer that could save a bit of trial-and-error. – ThatGraemeGuy Jun 15 '11 at 9:08
Graeme, I know a quick and easy solution with exim: hubbed hosts. Regarding this matter, Postfix is somewhat more picky about who its friends are :) – Vincent De Baere Jun 15 '11 at 11:17

Sounds like your postifx box is acting as a secondary MX (with Exchange as the primary). Just configure it as such.

share|improve this answer
No it only relays mail, it doesn't receive. – ThatGraemeGuy Jun 15 '11 at 10:35
What is it relaying if it doesn't receive mails? Assuming you mean that it's not exposed on the network as a secondary MX, that doesn't matter (just skip the steps for the DNS config) – symcbean Jun 16 '11 at 12:30
It doesn't "receive" in the sense that it's not listed as the MX for anything. It receives mail from various app servers and delivers it to the destination. – ThatGraemeGuy Jun 17 '11 at 7:20
So its a secondary MX – symcbean Jun 22 '11 at 8:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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