Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 mail.example.com. 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

3 Answers 3

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
up vote 5 down vote accepted

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

Add the following to /etc/postfix/main.cf:

relay_domains = domain1.com, domain2.com
transport_maps = hash:/etc/postfix/transport

Create the file /etc/postfix/transport:

domain1.com  smtp:[mail.example.com]
domain2.com  smtp:[mail.example.com]

Run these commands:

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

http://www.postfix.org/transport.5.html 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

Your Answer

 
discard

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.