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/smtpd_recipient_restrictions.cf and add this line at the top.
2. Open file /opt/zimbra/conf/zmconfigd.cf and Find the section labeled SECTION mta and enter the following two lines directly below
3. Create a file "/opt/zimbra/conf/postfix_check_recipient_access.cf" and add the folloeing line
4. Create a file "/opt/zimbra/conf/restricted_senders" and list all the users, whom you want to restrict. Follow this syntax:
Do the following activity as Zimbra user.
1. Open file /opt/zimbra/conf/zmconfigd/smtpd_recipient_restrictions.cf and add this line at the top.
check_sender_access lmdb:/opt/zimbra/conf/restricted_senders
POSTCONF smtpd_restriction_classes local_only
POSTCONF local_only FILE postfix_check_recipient_access.cf
check_recipient_access lmdb:/opt/zimbra/conf/local_domains, reject
user@yourdomain.com local_only
If you would like to restrict all users of a domain, enter the domain name instead of email ids. For example:
yourdomain.com local_only
5. Create a file "/opt/zimbra/conf/local_domains" and list all the domains where "restricted users" allowed to sent emails.
yourdomain.com OK
otheralloweddomain.com 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