Block all messages From/To specific domain

How to block sending and receiving emails From or To a specific domain? Like:

  • Gmail
  • Hotmail
  • AOL
  • etc.

Without using smtpd_sender_restrictions from Postfix, but only with one simple rule and MSH Traffic Policy application.

The easiest way to do this is to create a rule with Block Message action.

In Block Message action window select reject option.

Now on the Conditions tab define a domain which should be blocked. For this example use * domain. Select Message Sender menu from the list.

Add domain with asterisk character at front to match any email address in domain.

Select Message Recipient conditions from the list.

Add domain with asterisk and choose TO,CC and BCC option from drop down menu.

Don’t forget to select Any condition must met.

With that rule all message will be rejected (from or to domain). There is no limit of defined domains, so adding new one is as easy as previous one.

To learn more visit MSH Traffic Policy website.

Łukasz is a software developer and owner of MSH Software company which builds email processing tools for Microsoft Exchange, Zimbra Collaboration Suite and Postfix. He specializes in server, desktop and web applications written in Java, .NET and C++.