How to block all domains mail in cpanel

To block all domains from sending mail in cPanel, you can follow these steps:

Method 1: Using the "Email" section in cPanel

  1. Log in to your cPanel account.
  2. Click on the "Email" section.
  3. Click on "Email Deliverability" (or "Email Authentication" in older cPanel versions).
  4. Scroll down to the "Block Email" section.
  5. Click on the "Add Block" button.
  6. In the "Block Email" form, select "All domains" from the "Domain" dropdown menu.
  7. Set the "Block" option to "Yes".
  8. Click "Save" to save the changes.

Method 2: Using the "Exim Configuration Editor" in cPanel

  1. Log in to your cPanel account.
  2. Click on the "Advanced" section.
  3. Click on "Exim Configuration Editor".
  4. In the Exim configuration editor, scroll down to the "acl_check_rcpt" section.
  5. Add the following lines at the end of the section:
    deny  message = "All domains blocked"
    !i;
  6. Click "Save" to save the changes.

Method 3: Using a.htaccess file

  1. Log in to your cPanel account.
  2. Click on the "File Manager" section.
  3. Navigate to the root directory of your website (usually public_html or www).
  4. Create a new file called ".htaccess" (if it doesn't already exist).
  5. Add the following lines to the file:
    <IfModule mod_authz_host.c>
    Order deny,allow
    Deny from all
    </IfModule>
  6. Save the changes.

Note: The above methods will block all domains from sending mail, including your own domain. If you want to allow your own domain to send mail, you'll need to add an exception in the "Block Email" form or the Exim configuration editor.

Also, keep in mind that blocking all domains from sending mail may have unintended consequences, such as preventing legitimate emails from being sent. It's recommended to only block specific domains or IP addresses that are known to be sending spam.