There was a problem loading the comments.

How to Block Accounts from Sending Emails in WHM – Softsys Hosting

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

 

How to Block Accounts from Sending Emails in WHM – Softsys Hosting

If you're managing a cPanel server via WHM and want to prevent specific accounts from sending emails (e.g., due to abuse, spam, or policy violations), WHM provides a built-in way to restrict outbound email per user.

This guide explains how to block email-sending privileges for specific cPanel accounts on your Softsys Hosting VPS or Dedicated Server with WHM access.


📌 Requirements

  • Root access to WHM on your server

  • The server must be running Exim (default on cPanel/WHM)


🚫 Why Block Email Sending?

There are several reasons to block a cPanel user from sending mail:

  • The account was compromised and is sending spam

  • The website has outdated scripts vulnerable to abuse

  • The client exceeds your email usage policy

  • You are performing maintenance and want to temporarily halt email activity


🔧 Steps to Block Outgoing Email for a cPanel Account

  1. Log in to WHM as root:
    👉 https://your-server-ip:2087/

  2. In the search bar, type “Mail” and click on:
    Mail Delivery Reports (optional – use to confirm spam issues)

  3. To block an account, go to:
    Home » Email » Mail Delivery Reports (for diagnostics)
    Then proceed to:

  4. Navigate to:
    Home » Account Functions » Manage Account Suspension

    Or alternatively, use the Exim configuration below.


🛠️ Method: Use /etc/cpanel_exim_system_filter

For more control, you can add rules directly in the Exim system filter to block email sending from specific users.

Step 1: Edit Exim System Filter File

nano /etc/cpanel_exim_system_filter

Step 2: Add the Following Block Rule

Replace user_to_block with the actual cPanel username:

if first_delivery
and ("$authenticated_id" is "user_to_block")
then
  log_message = User user_to_block is not allowed to send emails
  seen finish
endif

Step 3: Save and Exit


🔁 Restart Exim

After updating the filter, restart Exim to apply changes:

/scripts/buildeximconf
service exim restart

✅ To Re-Enable Email Sending

Simply remove or comment out the blocking lines from the Exim filter, rebuild the Exim config, and restart the service.


🛡️ Best Practices

  • Always inform the user before blocking, if possible.

  • Use email throttling or limit settings as an alternative in:
    WHM » Tweak Settings » Mail

  • Regularly monitor outgoing mail logs using:

    exigrep user@domain /var/log/

Share via
Did you find this article useful?  

Related Articles

Tags

© Softsys Hosting