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:
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:
5. Create a file /opt/zimbra/conf/local_domains and list all the domains where restricted users are allowed to sent emails.
6. Finally, run this commands to implement new rules:
To undo this configuration
Remove added lines from /opt/zimbra/conf/zmconfigd.cf file and run this commands:
postconf -e smtpd_restriction_classes=' '