How to block a mail from particular domain

To block a mail from a particular domain, you can use various methods depending on your email client or server. Here are some common ways to do so:

Method 1: Using a Spam Filter

If you're using a spam filter like SpamAssassin, SpamFilter, or SpamSieve, you can add the domain to the filter's blocklist. This will prevent emails from that domain from reaching your inbox.

Method 2: Using a Mail Client (e.g., Outlook, Thunderbird)

  1. Open your email client and go to the settings or options menu.
  2. Look for the "Filters" or "Rules" section and click on it.
  3. Create a new filter or rule with the following conditions:
    • "From" or "Sender" contains the domain you want to block (e.g., @example.com).
    • Set the action to "Delete" or "Move to Junk" or "Block".
  4. Save the filter or rule.

Method 3: Using a Mail Server (e.g., Postfix, Exim, Sendmail)

  1. Edit your mail server's configuration file (e.g., /etc/postfix/main.cf for Postfix).
  2. Add the following lines to the file:
    • smtpd_recipient_restrictions = check_recipient_access pcre:/etc/postfix/recipient_access
    • recipient_access = pcre:/etc/postfix/recipient_access
  3. Create a new file /etc/postfix/recipient_access with the following content:
    • @example.com REJECT
  4. Save the file and restart your mail server.

Method 4: Using a DNS Blackhole

You can also use a DNS blackhole to block emails from a particular domain. This method requires modifying your DNS settings.

  1. Create a new DNS record with the following settings:
    • Type: TXT
    • Name: _mail.example.com (replace example.com with the domain you want to block)
    • Value: v=spf1 -all
  2. This will create a blackhole for emails sent from the specified domain.

Method 5: Using a Third-Party Service

There are also third-party services like Spamhaus, SORBS, and SpamFilter that allow you to block emails from specific domains. You can add the domain to their blocklist, and they will prevent emails from that domain from reaching your inbox.

Remember to always verify the authenticity of the emails you receive, even if you've blocked a domain.