How to block mail for whole domain users

To block mail for whole domain users, you can use various methods depending on your email server and domain configuration. Here are a few approaches:

Method 1: Using a mail server's built-in features

  1. Postfix (Linux): You can use the smtpd_client_restrictions directive in your Postfix configuration file (/etc/postfix/main.cf) to block mail for a specific domain. For example:

    smtpd_client_restrictions = check_client_access cidr:/etc/postfix/blacklist, reject

    Then, create a file /etc/postfix/blacklist with the following contents:

    127.0.0.1/32  whole-domain.com

    This will block all mail from the whole-domain.com domain.

  2. Exim (Linux): You can use the acl_smtp_rcpt directive in your Exim configuration file (/etc/exim.conf) to block mail for a specific domain. For example:

    acl_smtp_rcpt = acl_check_rcpt

    Then, create a file /etc/exim/acl_check_rcpt with the following contents:

    deny sender = whole-domain.com

    This will block all mail from the whole-domain.com domain.

Method 2: Using a DNS-based solution

  1. SPF (Sender Policy Framework): You can create a SPF record for your domain that specifies which mail servers are authorized to send mail on behalf of your domain. This can help prevent spam and phishing attacks.
  2. DKIM (DomainKeys Identified Mail): You can create a DKIM record for your domain that authenticates the sender of an email message. This can help prevent email spoofing attacks.

Method 3: Using a third-party service

  1. Cloud-based email filtering services: Services like SpamAssassin, SpamFilter, or Cloudmark can be configured to block mail for a specific domain.
  2. Email security gateways: Appliances like Barracuda Spam & Virus Firewall or MailGuard can be configured to block mail for a specific domain.

Important notes

Remember to consult your email server's documentation and configuration files for specific instructions on how to implement these methods.