How to Create a Spam Filter

Let’s be honest, no one likes spam; not hosting providers, not web users, and certainly not us. That’s why it has become a reccurring subject on the cPanel Blog. Using one of our favorite features, Apache SpamAssassin, we want to equip you, the cPanel user, with a nifty trick to keep spam out of your inbox.

Apache SpamAssassin™

Preloaded into the cPanel dashboard, Apache SpamAssassin is an open-source tool built to filter and classify emails while blocking spam. Through a combination of subject line and body text analysis, Bayesian filtering, and DNS blacklists, SpamAssassin drastically limits and can prevent spam from touching your inbox.

Creating a Spam Filter

In the Email section of your cPanel account, choose Apache SpamAssassin. (If your hosting provider hasn’t already enabled this feature, select Apache SpamAssassin and then switch it on.)

Now you’re ready to set up email filters and specify how powerfully you’d like SpamAssassin to gate and vet incoming messages. Here’s how:

  1. Head to the “cPanel Email” section, navigate to “Global Email Filters,” and select “Create New Filter.”
  2. Select “Spam Bar” from the first menu in the “Rules” section and then choose “Contains” from the second menu in that same section.
  3. In that field, enter a spam score using a series of (+) symbols, with 5 being an adequate number for an individual user. Select “Deliver to folder” from the “Actions” section and enter the name of the folder to which you would like to direct spam.
  4. Click “Create” to activate the spam filter and, voila, your first filter is set up! (Be sure to check to occasionally check this folder to ensure items that are NOT spam aren’t being flagged.)

This article was originally posted on Jan 19, 2016, and has been updated for technical accuracy. 

Follow the links to learn more about creating spam filters or Apache SpamAssassin.


The web hosting industry's most reliable management solution since 1997. With our first-class support and rich feature set, it's easy to see why our customers and partners make cPanel & WHM their hosting platform of choice. For more information, visit

One response to “How to Create a Spam Filter”

  1. This is a nice how-to. You can also create a spam box in the SpamAssasin page much easier by just clicking “Enable Spam Box” and it creates the filter/folder automatically.

Leave a Reply