This document describes how to restrict a list of users for sending emails to limited domains. Other users can send mails anywhere. All steps I am doing here as Zimbra user. These steps are verified on ZCS 8.x or newer.
You have to be logged in as a root.
If you can open file you can set full permission with the following command as root
Step 1 – Set permission as root
Step 2 – You must work as zimbra user.
Step 3 – Enter in file /opt/zimbra/conf/zmconfigd/smtpd_recipient_restrictions.cf this line check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders
Step 4 – Your file look like as this:
Step 5 – Set permission on this file /opt/zimbra/conf/zmconfigd.cf with the following command:
Step 6 – Then and add those lines before RESTART mta.
POSTCONF local_only FILE postfix_check_recipient_access.cf
Step 7 – Your file look like as this:
Step 8 – Execute the following command and this line check_recipient_access lmdb:/opt/zimbra/postfix/conf/local_domains, reject
Step 9 – Execute the following nano /opt/zimbra/conf/postfix_check_recipient_access.cf command and add all the users, whom you want to restrict. Follow this syntax:
Step 10 – Execute the following nano /opt/zimbra/postfix/conf/local_domains command and add all the domains, whom you want to allow to sending mail. Follow this syntax:
Step 11 – For the changes to take effect execute the following commands:
zimbra@mail:~$ postmap /opt/zimbra/postfix/conf/local_domains
If you insert new user or new domain don’t forget to running again number 11.
Step 12 – Restart service.
zimbra@mail:~$ zmmtactl start
Step 13 – When you attempt to sending mail from not allowed user you will see this.