How To Block user to send email locally or externally In zimbra

Step 1: This complete Block user guide walks you through everything step by step.

Open file /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf and add the below line at the top.

check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders

Step 2:

Open file /opt/zimbra/conf/zmconfigd.cf and add below lines before “RESTART mta”.

POSTCONF    smtpd_restriction_classes  local_only
POSTCONF    local_only  FILE  postfix_check_recipient_access.cf

Note: We can find like below

SECTION mta DEPENDS amavis
 -----------
 -----------
 -----------
RESTART mta

Step 3:

Create a file /opt/zimbra/conf/postfix_check_recipient_access.cf and add the following line.

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

Step 4:

Create a file /opt/zimbra/common/conf/restricted_senders and enter the list of users that you want to block. Follow this syntax:

[email protected]            local_only

Step 5:

[zimbra@mail ~]# vi /opt/zimbra/common/conf/local_domains
sajjan.com.np            OK

i.e.: Allow User/Domain ([email protected] OK/domain.com OK)

Step 6:

Set ownership permissions for created files

chown zimbra:zimbra /opt/zimbra/conf/postfix_check_recipient_access.cf
chmod 644 /opt/zimbra/conf/postfix_check_recipient_access.cf
chown :zimbra /opt/zimbra/common/conf/restricted_senders
chmod 775 /opt/zimbra/common/conf/restricted_senders
chown :zimbra /opt/zimbra/common/conf/local_domains
chmod 775 /opt/zimbra/common/conf/local_domains

Step 7:

Run the below commands as Zimbra user.

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

Block user – Key Takeaways

To get Block user working properly, follow each step in the guide above in order. If something doesn't work, revisit the prerequisites and try again.

Related Guides

Key Takeaways

  • This guide covered blocking a Zimbra user step by step, from prerequisites to verification.
  • Always test changes on a staging server before applying them in production.
  • Keep backups of your configuration files so you can roll back quickly if needed.
  • For related tutorials, see our other guides on email servers and VPS management.

Troubleshooting Tips

If you run into issues while blocking a Zimbra user, check the system logs first — most errors leave a clear trace in /var/log/. Make sure all required packages are installed and your firewall allows the necessary ports. Restarting the relevant service often resolves transient failures. If a step fails consistently, verify file permissions and ownership, as incorrect permissions are a common cause of silent failures on Linux servers.

Frequently Asked Questions

Do I need root access? Yes, most server administration tasks require root or sudo privileges.

Will this work on other Linux distributions? The concepts apply broadly, though exact commands and file paths may differ between distributions.

How do I verify it worked? Follow the verification steps in the guide above and check the service status with systemctl status.

Leave a Comment