Clisec
ProductsAnti-spamPrecise filtering of spam and bulk campaigns, without penalizing legitimate mail.Anti-phishing & BECStops impersonation, malicious links, and email fraud before the inbox.cPanel® pluginOne agent protects the whole server; each user manages from their cPanel.Explore
PricingGuidesContactAbout us
Guide · cPanel antispam

cPanel email filters: account-level and global rules against spam and phishing

How to create email filters and global email filters in cPanel to block senders, domains and phishing, with sample rules and the Exim system filter.

Updated on 9 min readClisec team

In short

cPanel has two kinds of filters: Email Filters, which apply to a single account, and Global Email Filters, which apply to all mail for the cPanel account. They let you block a sender or a domain, move messages by spam score and set suspicious mail aside. They don't replace an antispam: they check one message at a time with fixed rules. For the whole server there is also the Exim system filter, configured in WHM.

Which filters cPanel has

ToolWhereScopeWhat it's for
Email FilterscPanel › Email › Email FiltersOne email accountPersonal rules: move, forward or discard
Global Email FilterscPanel › Email › Global Email FiltersEvery account in that cPanel accountBlocking a sender for the whole company
Spam Filters listscPanel › Email › Spam FiltersEvery account in that cPanel accountAdding or removing SpamAssassin points for a sender
Exim system filterWHM › Exim Configuration Manager › FiltersThe whole serverAdministrator rules that affect every customer

If you want to tune the SpamAssassin score or the spam folder, that is covered in how to configure SpamAssassin in cPanel. This guide covers condition-based rules.

How to create a filter step by step

  1. Go to cPanel › Email › Global Email Filters (or Email Filters, and pick the account).
  2. Click Create a New Filter and give it a name that explains why it exists, for example "Block fake invoices".
  3. Under Rules, choose the part of the message (From, Subject, To, Any Header, Body, Spam Status, Spam Score…), the operator (contains, matches regex, begins with…) and the value.
  4. Under Actions, choose what to do: Deliver to Folder, Redirect to Email, Fail with Message, Discard Message or Stop Processing Rules.
  5. Save and test it with the Filter Test tool on the same page, pasting the headers of a real message.

Seven useful rules against spam and phishing

GoalRuleAction
Block a senderFrom · contains · offers@spam-domain.comDeliver to Folder "Review", or Discard
Block a whole domainFrom · ends with · @spam-domain.com>Discard Message
Keep near-certain spam out of the inboxSpam Score · is greater than · 10Discard, or Deliver to Folder "spam"
Mail from heavily abused domain extensionsFrom · matches regex · \.(top|xyz|click|shop)>?$Deliver to Folder "Review"
Impersonation of your manager's nameFrom · contains · First Last, and From · does not contain · @yourcompany.comDeliver to Folder "Review"
Fake "mailbox full" noticesSubject · matches regex · (mailbox|quota).*(full|exceeded|suspend)Deliver to Folder "Review"
Replies diverted to another domainAny Header · matches regex · ^Reply-To:.*@(gmail|outlook|hotmail)\.Deliver to Folder "Review"

The last two rules target specific attacks: fake cPanel and Webmail emails asking for the password with a "mailbox full" excuse, and BEC fraud, which diverts replies to the attacker's free account. Check the folder for the first few weeks: real suppliers and customers use Gmail too.

In a rule with several conditions, cPanel lets you choose between "and" and "or". For the manager impersonation rule you need "and": the name appears and the domain isn't yours.

What filters can't do

cPanel filters are useful for one-off cases, but they have clear limits:

  • They don't inspect attachments. The "Body" condition only sees the start of the message, so it can't detect a dangerous file. That is what Exim's attachment filter is for.
  • They don't follow links. A rule can't tell whether a link leads to a fake login page.
  • They don't verify the sender. "From contains @bank.com" also matches an email spoofing the bank. Use SPF, DKIM and DMARC for that.
  • They don't scale. Every new attack needs another rule, and old rules stay there catching false positives years later.
  • Attackers use them too. Whoever steals a password often creates a filter that forwards or hides messages. Check an account's filters if you suspect it was compromised.

The Exim system filter (for administrators)

As the server administrator you can apply a rule to all mail without going into each account. Exim uses a system filter file, /etc/cpanel_exim_system_filter by default. Don't edit that file: cPanel replaces it on updates. Copy the original, add your rules at the end and point the System Filter File option in the Filters tab to the copy.

# Example: tag the subject of outside mail that uses your manager's name
if $header_from: contains "First Last"
   and $header_from: does not contain "@yourcompany.com"
then
  headers add "X-Warning: external sender using an internal name"
  headers remove "Subject"
  headers add "Subject: [EXTERNAL] $h_subject:"
endif

Test the filter before enabling it with exim -bF filter-file < message.eml, which shows what it would do without delivering anything. A syntax error in the system filter can stop delivery for the whole server.

When filters are no longer enough

If you add rules for a different attack every week, the problem is no longer about rules. Bulk spam is better stopped by RBLs and greylisting (Exim antispam settings in WHM), and targeted phishing needs a filter that analyzes links, attachments and impersonation in every message. We compare the options in cPanel antispam.

Frequently asked questions

How do I block an email address or a domain in cPanel?

In cPanel › Email › Global Email Filters, create a rule "From · contains" with the address, or "From · ends with" with the domain, and the action "Discard Message" or a review folder. It applies to every account in that cPanel account.

What is the difference between global and account filters?

Global filters affect all mail received by the cPanel account, in every mailbox. Account filters affect only that mailbox, and users can create them themselves from Webmail.

Why isn't my filter working?

Most often the condition doesn't match exactly: the From field includes the display name and the < > signs. Use "contains" instead of "equals" and test the rule with the Filter Test tool.

Do cPanel filters help against phishing?

They help against specific campaigns you already know, such as a repeated subject. They don't catch new phishing, because they don't analyze links or verify the sender.

Antispam and antiphishing for your whole cPanel server

Instead of one rule per attack, Clisec analyzes every inbound message on your cPanel server and blocks phishing, BEC fraud and malware, with quarantine and per-user release.

Request a demoSee the cPanel plugin

Keep reading

Guide · SpamAssassinHow to configure SpamAssassin in cPanelTurning it on per account and server-wide, which score to use, and the mistakes that cause the most false positives.ReadComparison guide · cPanel antispamcPanel antispam: how to choose the right filter (2026 comparison)Built-in tools, plugins and cloud gateways: what each one filters, what it requires and which fits your server.ReadGuide · PhishingFake cPanel and Webmail emails: "your mailbox is full" and other scamsMailbox full, held messages, password expiring: how to spot these scams and what to do if someone fell for one.Read