Published June 14, 2019 by

Restrict users to send mails to certain domains in Zimbra Mail server

This article, I have been explained how to restrict users to send emails to certain users or domains in the Zimbra mail server.

Do the following activity as Zimbra user.

1. Open file /opt/zimbra/conf/zmconfigd/ and add this line at the top.
 check_sender_access lmdb:/opt/zimbra/conf/restricted_senders  

2. Open file /opt/zimbra/conf/ and Find the section labeled SECTION mta and enter the following two lines directly below
 POSTCONF  smtpd_restriction_classes   local_only  
 POSTCONF  local_only                 FILE  

3. Create a file "/opt/zimbra/conf/" and add the folloeing line
 check_recipient_access lmdb:/opt/zimbra/conf/local_domains, reject  

4. Create a file "/opt/zimbra/conf/restricted_senders" and list all the users, whom you want to restrict. Follow this syntax:      local_only  

If you would like to restrict all users of a domain, enter the domain name instead of email ids. For example:      local_only  

5. Create a file "/opt/zimbra/conf/local_domains" and list all the domains where "restricted users" allowed to sent emails.           OK   OK  

6. Finally, Run below commands for implement
 postmap /opt/zimbra/conf/restricted_senders  
 postmap /opt/zimbra/conf/local_domains   
 zmmtactl stop   
 zmmtactl start  

Please try to sending email to allowed domain and not allowed domain. If you insert new user on number 4 or new domain on number 5, don’t forget to run again number 6.

Undo this configuration

Remove Step 2

and run below commands:
 postconf -e smtpd_restriction_classes=' '  
 zmmtactl reload