Relay per Domain

Revision as of 22:48, 26 December 2017 by Heera Singh Koranga (talk | contribs) (ZCS 8.7 instructions)

Relay per Domain

   KB 2888        Last updated on 2017-12-26  

(0 votes)

Reference bugs: and

Zimbra allows relaying emails to a specific server only, i.e using zimbraMtaRelayHost. However, there are needs to relay emails per domain basis based on the sender. For example, you want emails sent by should be relayed through and through servers. You can configure it using postfix's "sender_dependent_relayhost_maps".

This is an example that has been tested on ZCS 5.0.16 and ZCS 7.1.4

Note: Below settings will not survive zimbra upgrades. Make sure you take backup of config files before upgrading.

1. Add following line to /opt/zimbra/postfix/conf/

Pre 8.5:
sender_dependent_relayhost_maps = hash:/opt/zimbra/postfix/conf/bysender
sender_dependent_relayhost_maps = lmdb:/opt/zimbra/postfix/conf/bysender

2. Create file /opt/zimbra/postfix/conf/bysender and enter your domain names and relay server's IP addresses.  []  []

You can even add individual email IDs to relay their emails to specific relay host. []

3. Create the hash file.

postmap /opt/zimbra/postfix/conf/bysender

4. Restart zmmtactl

zmmtactl stop
zmmtactl start

5. Test by sending emails.

ZCS 8.7 instructions

1. Open /opt/zimbra/common/conf/ file for editing with your favorite editor (e.g. vi).

2 . Find the sender_dependent_relayhost_maps parameter and set it to be lmdb:/opt/zimbra/common/conf/bysender

sender_dependent_relayhost_maps = lmdb:/opt/zimbra/common/conf/bysender


sender_dependent_relayhost_maps (default: empty)
A sender-dependent override for the global relayhost parameter setting.The tables are searched by the envelope sender address and @domain. 

3.Create a file /opt/zimbra/common/conf/bysender and enter your domain names and relay server's IP addresses.  []  []

4. Create the hash file.

postmap /opt/zimbra/common/conf/bysender 


zmmtactl stop; zmmtactl start

Verified Against: ZCS 5.0.16 Date Created: 6/4/2009
Article ID: Date Modified: 2017-12-26

Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search