Relay Tips Based on User/Domain Sender on Zimbra 8.5-8.6

Home » Zimbra » Relay Tips Based on User/Domain Sender on Zimbra 8.5-8.6
Zimbra 4 Comments

On previous post, we can relay email based on user/domain receiver. But, on this guidance is reverse from previous post. ie the relay based on user/domain sender. Zimbra supported for multi domain. You can have many domain in one Zimbra server. I have condition where either domain cannot sending to some domains. For example, i have 2 domains in Zimbra server, domain1.com and domain2.com.

domain1.com can sending email to domain3.com but domain2.com cannot sending email to domain3.com. Whereas domain1.com and domain2.com are in one Zimbra server. it is rather strange indeed. For be able sending to domain3.com from domain2.com, i am decide to relay every sending email from domain2.com. For do that, i do the following guidance

# Add the following configuration in /opt/zimbra/postfix/conf/main.cf

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

# Create file above and adding users/domains would be relay

vi /opt/zimbra/postfix/conf/bysender

Fill as the following example

@domain2.com           [relay.example.com]
user1@domain1.com      [relay.example.com]

configuration above will do relay every sending email from @domain2.com and user1@domain1.com to relay server at relay.example.com

# Postmap file

postmap /opt/zimbra/postfix/conf/bysender

# Reload Postfix

postfix reload

Note : every add/delete users/domains in /opt/zimbra/postfix/conf/bysender, don’t forget to postmap and reload postfix

Good luck and hopefully useful 😀

4 thoughts on - Relay Tips Based on User/Domain Sender on Zimbra 8.5-8.6

  • doesnt working for me . I have a global smtp configured already on zimbra 8.6

    maillog error
    Jun 13 12:33:52 mail postfix/trivial-rewrite[4050]: warning: lmdb:/opt/zimbra/postfix/conf/bysender lookup error for “test@example.com”
    Jun 13 12:34:39 mail postfix/trivial-rewrite[4050]: warning: lmdb:/opt/zimbra/postfix/conf/bysender is unavailable. open database /opt/zimbra/postfix/conf/bysender.lmdb: No such file or directory
    Jun 13 12:34:39 mail postfix/trivial-rewrite[4050]: warning: lmdb:/opt/zimbra/postfix/conf/bysender lookup error for “”
    Jun 13 12:34:43 mail postfix/trivial-rewrite[4050]: warning: lmdb:/opt/zimbra/postfix/conf/bysender is unavailable. open database /opt/zimbra/postfix/conf/bysender.lmdb: No such file or directory

    Please help 🙂

  • Hello this is great but I seem to have a problem:

    postconf -n | grep bysender
    sender_dependent_relayhost_maps = lmdb:/opt/zimbra/postfix/conf/bysender

    ls -lsa /opt/zimbra/postfix/conf/bysender.lmdb
    20 -rw-r–r– 1 zimbra zimbra 20480 Dec 15 17:30 /opt/zimbra/postfix/conf/bysender.lmdb

    cat /opt/zimbra/postfix/conf/bysender
    @mydomain.fr [10.42.0.40]

    postfix reload


    Still I see the messages going by the mx record for the domain.

LEAVE A COMMENT