Email 7 min read

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.

By BashPilot Team
BashEmail Email spam protection Keep outbound mail clean and off blacklists, automatically. Explore BashEmail

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.

SettingWhereDefault
Enable Apache SpamAssassin spam filterTweak Settings, MailOn
Spam Box delivery (user configurable)Tweak Settings, MailOn
Apache SpamAssassin: Forced Global ONExim Basic EditorOff
Message size threshold to scanExim Basic Editor1000 KB
RBL: zen.spamhaus.orgExim Basic Editor, RBLsOff
RBL: bl.spamcop.netExim Basic Editor, RBLsOff
Reject spam score thresholdExim Basic Editor, ACL OptionsNo reject rule
Sender VerificationExim Basic Editor, MailOn
Allow DKIM verification for incoming messagesExim Basic EditorOff

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. 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. 2

    Move spam to its own folder

    Enable Move New Spam to a Separate Folder. Marked mail lands in a spam folder the customer can check, so a false positive costs a click instead of a lost order.

  3. 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. 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:

look up a SpamAssassin rule's default score
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.

run this on the mail server
dig +short 2.0.0.127.zen.spamhaus.org
AnswerWhat it means
127.0.0.2, 127.0.0.4, 127.0.0.10Working correctly
127.255.255.254Your query came through a public or open resolver, and Spamhaus refused it
127.255.255.255Excessive query volume
Nothing at allAlso 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

RBL activity and recent rejections
grep -i 'rbl' /var/log/exim_mainlog | tail -n 20
tail -n 20 /var/log/exim_rejectlog
  • New spam arrives in the spam folder and carries an X-Spam-Status: Yes header.
  • 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.

Share LinkedIn X
Questions

Frequently asked questions

How do I turn on the spam filter in cPanel?

Open Email, then Spam Filters, and enable Process New Emails and Mark them as Spam. To move marked mail into a separate folder, also enable Move New Spam to a Separate Folder. An administrator can force scanning for every account with the Forced Global ON option in WHM's Exim Configuration Manager.

What is a good spam score in cPanel?

cPanel describes 1 as aggressive and 10 as passive. Start with the existing value, send spam to a Spam Box, and change it one point at a time while watching for false positives. The right value depends on each customer's mail, which is why a single server-wide number rarely suits everyone.

Why is my Spamhaus RBL not blocking anything in WHM?

Your server may be using a public DNS resolver. Run `dig +short 2.0.0.127.zen.spamhaus.org`. A working setup returns addresses such as `127.0.0.2`. An answer of `127.255.255.254`, or nothing at all, means queries are not being served. Use your own resolver or Spamhaus's paid data service.

Should I reject spam at SMTP time in cPanel?

Only with a high threshold, and after watching real mail for a while. cPanel notes that messages rejected at SMTP time are discarded, so there is no copy to recover. A Spam Box handles uncertain mail more safely, leaving rejection for messages that are clearly junk.

Does the cPanel spam filter work with a remote MX?

No. cPanel states that Apache SpamAssassin will not scan incoming mail for domains that use a remote MX, smarthost or email relay. Filtering for those domains has to happen on the service that receives the mail first.

Put your servers on autopilot.

Connect a server in about a minute. The first week is on us.