How to block external email from domains or individual email
To configure ZIMBRA to reject external email addressed to users in the system, or blacklist email, follow these steps.
- Configure smtpd_sender_restrictions as shown below. ZIMBRA 7: Run:
$ zmlocalconfig -e postfix_smtpd_sender_restrictions="hash:/opt/zimbra/postfix/conf/postfix_reject_sender"
ZIMBRA 8.0: Add “client_sender_access hash:/opt/zimbra/postfix/conf/postfix_reject_sender” to /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf. ZIMBRA 8.5 and 8.6: Edit /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf and insert the following text on line 2.
%%contains VAR:zimbraMtaSmtpdSenderRestrictions check_sender_access lmdb:/opt/zimbra/postfix/conf/postfix_reject_sender%%
Then run:
$ zmprov ms `zmhostname` +zimbraMtaSmtpdSenderRestrictions "check_sender_access lmdb:/opt/zimbra/postfix/conf/postfix_reject_sender"
- Create /opt/zimbra/postfix/conf/postfix_reject_sender, containing a list of email addresses or domains to block, followed by REJECT, as in the example.
[email protected] REJECT
domain.com REJECT
- Run postmap to create the database and restart postfix.
$ /opt/zimbra/postfix/sbin/postmap /opt/zimbra/postfix/conf/postfix_reject_sender
$ zmmtactl stop && zmmtactl start
** You can use Amavis for blacklisting instead.