Restrict domains in ✉️ Zimbra Mail server

Restrict domains in ✉️ Zimbra Mail server

Here is how to restrict users to send emails to certain domains in the Zimbra mail server.

1. Open file /opt/zimbra/conf/zmconfigd/smtpd_recipient_restrictions.cf and add this line:

 check_sender_access lmdb:/opt/zimbra/conf/restricted_senders

2. Open file /opt/zimbra/conf/zmconfigd.cf and Find the section labeled SECTION mta and enter the following two lines:

 POSTCONF  smtpd_restriction_classes   local_only  
 POSTCONF  local_only                 FILE postfix_check_recipient_access.cf  

3. Create a file /opt/zimbra/conf/postfix_check_recipient_access.cf and add:

 check_recipient_access lmdb:/opt/zimbra/conf/local_domains, reject  

4. Create a file /opt/zimbra/conf/restricted_senders and list all the domains that you want to restrict. Follow this syntax:

 yourdomain.com      local_only

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

 yourdomain.com           OK   
 someotherdomain.com      OK

6. Finally, run this commands to implement new rules:

 postmap /opt/zimbra/conf/restricted_senders  
 postmap /opt/zimbra/conf/local_domains   
 zmmtactl stop   
 zmmtactl start  

To undo this configuration
Remove added lines from /opt/zimbra/conf/zmconfigd.cf file and run this commands:

 postconf -e smtpd_restriction_classes=' '  
 zmmtactl reload

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.