mail me! sindicaci;ón

Exim and Exchange

As part of a new project I’ve been working on I’ve had to install and configure an Exchange 2007 server within my home network. I’ve managed to finally get delivery to both Exim and Exchange working, dependent on the address mail is being sent to. Exim works as both a smarthost for Exchange and an independent mail server.

So for example, lm @nothingbutreboots.com goes to Exim (and then onto Cyrus via LMTP), which can be accessed using RoundCube. However, mail to luke.morgan @nothingbutreboots.com gets passed to Exchange. Similarly, Exchange uses my Exim box as it’s smarthost for outbound mail.

Here’s a quick look at the relevant bits of the Exim config files which may give somebody trying to do a similar thing a few pointers:

/etc/exim4/conf.d/router/200_exim4-config_primary

virtual:
driver = redirect
domains = dsearch;/etc/exim4/virtual/
data = ${lookup{$local_part}lsearch{/etc/exim4/virtual/$domain}}
#one_time
no_more

send_to_smart_host:
debug_print = “R: attempting to send to Exchange”
driver = manualroute
domains = ad.nothingbutreboots.com
transport = remote_smtp
route_data = “ad.nothingbutreboots.com”
no_more

send_to_cyrus:
debug_print = “R: attempting to send to cyrus $local_part@$domain”
driver = manualroute
domains = zivi.nothingbutreboots.com
transport = LOCAL_DELIVERY
route_list = +local_domains
no_more

So then you have the relevant domain listings within your virtual folder, which the virtual router will then parse as above and decide which transport to send the mail onto:

/etc/exim4/virtual/nothingbutreboots.com

luke.morgan luke.morgan@ad.nothingbutreboots.com
lm lm@nothingbutreboots.com

For the above to work you’ll obviously need correct MX entries within your BIND config and within your Windows DNS.

Leave a Comment