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.

link|improve this question

feedback

3 Answers

up vote 3 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
link|improve this answer
feedback

http://www.postfix.org/transport.5.html looks promising

link|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. – Graeme Donaldson 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
feedback

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

link|improve this answer
No it only relays mail, it doesn't receive. – Graeme Donaldson 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. – Graeme Donaldson Jun 17 '11 at 7:20
So its a secondary MX – symcbean Jun 22 '11 at 8:36
feedback

Your Answer

 
or
required, but never shown

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