Relay Mail To Two or Multiple eMail SMTP Servers Simultaneously Using exim in Linux CentOS 6 RHEL 6

Hey there fellow Hurston students! I recently completed migrating a Windows email server running SmarterMail to a Linux server running Zimbra. One of the methods used to ensure a smoother transition over to the Zimbra system was to configure an exim mail relay to receive mail destined for my domains and deliver them to both the old SmarterMail and new Zimbra systems at the same time which allows for a smoother transition to the new system. This setup will obviously work for any backend SMTP servers which have similar domain/user configuration and is not limited to this SmarterMail/Zimbra example.

NOTE: you will want to make sure you’ve setup all the domains and accounts on the new system to match the old, otherwise the new system will send bounce back messages, even though the message was successfully received on the old system as well. Also, this is really best to be a temporary setup for migration purposes. I don’t see a lot of use having this setup in a normal production mail environment.

First install exim from the EPEL repository:

yum -y install exim

The Main Configuration Items exist in /etc/exim/exim.conf

1. The following config items show the domain list syntax and also allowing for relay from the existing mail servers:

domainlist local_domains = @ : localhost : localhost.localdomain

domainlist relay_to_domains = vmhacks.com : mydomain02.com : mydomain03.com

hostlist relay_from_hosts = 127.0.0.1 : 192.168.1.2 : 192.168.1.3

2. In the Begin Routers section, we have routers defined to relay the mail:

begin routers

Zimbra:

driver = manualroute

domains = vmhacks.com : mydomain02.com : mydomain03.com

route_data = 192.168.1.2

transport = OutboundSMTP

unseen = true

SmarterMail:

driver = manualroute

domains = vmhacks.com : mydomain02.com : mydomain03.com

route_data = 192.168.1.3

transport = OutboundSMTP

NOTE: the “unseen = true” is the key to this trick, exim processes the mail item as defined in the Zimbra router, but then “unseen = true” tells it to keep going on to the next router for further processing.

3. Then in the begin transport section, you define the transports that you defined in the routers above:

begin transports

OutboundSMTP:

driver = smtp

4. Now you can start the service and make sure it comes on with the system at the relevant runlevels:

service exim start && chkconfig exim on

5. Final step is to change your MX records to point to your exim relay and you’re good to go.

Enjoy!
Mm.,

3 Comments

Kousalya (March 8, 2015)

Thanks for sharing this article. It is really helpful. I tried this using SMTP port as 25 and 587. It is working fine. But not with the port 465. How should I configure for this? It will be very helpful if you share that also.

jb007 (June 22, 2015)

I’m curious as to why you switched away from SmarterMail – I’m looking at the product, and curious if there are certain features or if it was a price-related reason?

Thanks!

maxmouse (July 6, 2015)

SmarterMail isn’t bad if it works for you, the motivation for me was to stop using Windows.

Comments are closed.