cPanel Spam Filter: The WHM Settings That Matter
cPanel ships with solid spam tools, but two of the strongest are off by default, and one of them can fail quietly because of your DNS resolver.
The cPanel spam filter is really several tools stacked together: Apache SpamAssassin scores each message, Exim can refuse mail at connection time, and every customer has their own settings on top. When someone says the filter does not work, the cause is usually one layer that was never turned on. Both of the blocklists WHM offers are off by default, for instance, and many servers have run that way for years.
Understand the two levels of control
Server settings live in WHM, mostly in Exim Configuration Manager's Basic Editor and on the Mail tab of Tweak Settings. Account settings live in each customer's Spam Filters interface in cPanel. A surprising number of tickets come from an admin tuning one level while the customer's setting at the other level decides the outcome.
| Setting | Where | Default |
|---|---|---|
| Enable Apache SpamAssassin spam filter | Tweak Settings, Mail | On |
| Spam Box delivery (user configurable) | Tweak Settings, Mail | On |
| Apache SpamAssassin: Forced Global ON | Exim Basic Editor | Off |
| Message size threshold to scan | Exim Basic Editor | 1000 KB |
| RBL: zen.spamhaus.org | Exim Basic Editor, RBLs | Off |
| RBL: bl.spamcop.net | Exim Basic Editor, RBLs | Off |
| Reject spam score threshold | Exim Basic Editor, ACL Options | No reject rule |
| Sender Verification | Exim Basic Editor, Mail | On |
| Allow DKIM verification for incoming messages | Exim Basic Editor | Off |
These defaults come from cPanel's Exim Configuration Manager documentation. Check them on your own server too, since a previous admin may have changed them.
Start with a filter customers can recover from
-
1
Turn on scoring for the account
In cPanel, open Email, then Spam Filters, and enable Process New Emails and Mark them as Spam. If you want this for every account with no way to opt out, use Forced Global ON in WHM, and tell customers first.
-
2
Move spam to its own folder
Enable Move New Spam to a Separate Folder. Marked mail lands in a
spamfolder the customer can check, so a false positive costs a click instead of a lost order. -
3
Leave Auto-Delete off at first
Auto-Delete removes anything at or above its score. It has its place for mailboxes buried in junk, but set it only after you have seen what lands in the Spam Box, and keep it well above the spam threshold.
-
4
Adjust the threshold slowly
cPanel describes a score of 1 as aggressive and 10 as passive. Move one point at a time and give each change a few days of real mail.
To see why a message scored the way it did, open its full headers and look for X-Spam-Status. It lists the score and each test that fired, which beats guessing. If one test keeps misfiring, the Calculated Spam Score settings let you change its weight or set it to 0, though cPanel recommends leaving that to advanced users. The default scores are on the server:
grep -R 'score RULE_NAME' /var/lib/spamassassin/ | head
Enable an RBL, and check it can answer
Real-time blocklists stop known bad senders before Exim accepts the message, which saves all the work of scanning it. In WHM, go to Service Configuration, then Exim Configuration Manager, then the RBLs section, and turn on the lists you want. Keep the exemptions for your own netblock and for the Greylisting Common Mail Providers list, which are on by default.
Before you rely on Spamhaus, test it from the server. Its address 127.0.0.2 is a permanent test entry, so a working setup always gets an answer.
dig +short 2.0.0.127.zen.spamhaus.org
| Answer | What it means |
|---|---|
127.0.0.2, 127.0.0.4, 127.0.0.10 | Working correctly |
127.255.255.254 | Your query came through a public or open resolver, and Spamhaus refused it |
127.255.255.255 | Excessive query volume |
| Nothing at all | Also a failure, since this test address is always listed. Some public resolvers return an empty answer |
This is the mistake that catches so many hosts. If /etc/resolv.conf points at a public resolver such as 8.8.8.8 or 1.1.1.1, the RBL appears enabled in WHM and quietly does nothing. The fix is a resolver of your own on the server or network, or Spamhaus's paid data service. Their DNSBL usage FAQ explains the terms, including who qualifies for free use, so read it if your mail volume is high or you run a commercial service.
Add SMTP-time rejection last
The Apache SpamAssassin reject spam score threshold, in ACL Options, refuses mail at or above a score during the SMTP conversation. It saves disk and customer attention, and it also gives you no copy of what was refused. cPanel's documentation is plain about it: the system discards messages that it rejects at SMTP time.
So set it high and only after a period of watching. A good way to pick the number is to look through a week of Spam Box mail, find the highest score on anything legitimate, and leave a generous margin above it. Whatever you pick, this should sit far above the score that sends mail to the Spam Box.
Confirm it is working
grep -i 'rbl' /var/log/exim_mainlog | tail -n 20
tail -n 20 /var/log/exim_rejectlog
- New spam arrives in the
spamfolder and carries anX-Spam-Status: Yesheader. - The log shows RBL rejections once your lists are active.
- Mail from your main customers and their usual senders still lands in the inbox.
- Nobody has reported missing mail for a full business week.
What the built-in filter leaves to you
The cPanel tools handle scoring well. They are thinner on the operational side: a quarantine customers can manage, policies you can set per mailbox, and containing an account that starts sending spam. Hourly caps help with that last one, as covered in cPanel Max Hourly Emails per Domain, and cPanel Server Sending Spam? walks through a live incident.
BashEmail for cPanel adds those pieces on the same server. Admins work in WHM, and each customer gets private quarantine access in the Email section of cPanel. Policy can differ per domain or mailbox. Outgoing abuse moves through watch, hold and sending-only suspension, so a customer can still receive mail while the problem is sorted. It needs no MX or DNS change and starts by observing, so you see what it would do before it changes delivery.