How to Setup cPanel Email Filters for an Individual Email Address

Step 1: Click on the ‘Email Filters’ icon

  • Click on the “Email Filters” icon on the cPanel dashboard.


Step 2: Click ‘Manage Filters’ next to your chosen email address

  • Click “Manage Filters” next to the email address you wish to create a filter for.

You can choose from email addresses you have created, as well as the default email address.

Step 3: Create a new Email Filter

On this page, you will see a list of your current email filters. You will also be able to create a new filter for that email address.

  • Click the “Create a New Filter” button to create the new filter.


Step 4: Configure Filter Name

  • Filter Name - Choose the name for your filter.

The name you give cannot contain “Rule #” or “Converted Rule” as you can see from the above image.

The filter name must also be unique. If you choose the same name as another filter, the existing filter will be overwritten.



Step 5: Configure Option Rules

You have a number of options to choose from here:

  • From - This is the “from” email address that you wish to match
  • Subject - This will filter by the subject of the email
  • To - This filters by the “To” email address
  • Reply Address - This filters by the “Reply” email address
  • Body - This will check the email body for any matches
  • Any Header - This will check the headers of the email
  • Any Recipient - This will check all the different recipients of the email
  • Has not been previously delivered - This will only filter emails that are still in the servers email queue
  • Is an error message - This will check the error message received by autoresponders, or email forwarders.
  • List ID - The account’s mailing lists.
  • Spam Status - Whether Apache SpamAssassin marked the message as spam. The Spam Status begins with a “Yes” or “No”
  • Spam Bar - The content of the Spam Bar header that Apache SpamAssassin generated. This is depicted using plus signs (+).
  • Spam Score - The total number of plus signs (+) in the Spam Bar. This is depicted as an integer (number).



Step 6: Configure Operator Rules

You have a number of rules to choose from here:

  • Equals - This will match identically the text entered
  • Matches Regex - You can enter a Regular Expression here
  • Contains - This will do a partial match of the specified string of characters
  • Does not Contain - This will check whether the email does NOT have a partial match of the specified string of characters
  • Begins with - This will check whether the Rule begins with the characters specified
  • Ends with - This will check whether the Rule ends with the characters specified
  • Does not begin with - This will check whether the Rule DOES NOT begin with the characters specified
  • Does not end with - This will check whether the Rule DOES NOT end with the characters specified
  • Does not match - This will check that it does not match the characters specified

The following relates to the SpamAssassin Spam Score:

  • is above (numbers only) - The Spam Score is greater than.
  • is not above (numbers only) - The Spam Score is equal to or less than.
  • is below (numbers only) - The Spam Score is less than.
  • is not below (numbers only) - The Spam Score is greater than or equal to.



Step 7: Configure Rule Match Criteria

Once you have chosen a Rule Option and Rule Operator, you will need to add what those will need to match.

This could be an email address, spam score, or emails containing a specific subject or keyword.

I’ll walk you through a couple of examples later, but for now, I will mark highlight all emails received from .



Step 8: Configure Action Rules

  • Discard Message - Deletes the message with no Failure message.
  • Redirect to Email - Sends the email to another email address.
  • Fail with Message - Deletes the email and sends a failure message.
  • Stop processing rules - Does not run any filter rules.
  • Deliver to folder - Sends the email to a specified folder.
  • Pipe to program - Sends the email to a program or script on the server.

If you choose to pipe the action to a program, the path used should be relative to your home directory. If the script the Perl or PHP interpreter, you should omit the /usr/bin/perl or /usr/local/bin/php portion. Make sure your script is executable and has the appropriate hash.

  • For PHP: #!/usr/local/bin/php -q
  • For Perl: #!/usr/bin/perl

In the example screenshot, I have chosen to ‘Deliver to Folder’. By doing this, you will then be able to browse and select the specific folder you wish it to be delivered. I have chosen the Junk folder in my example in the screenshot.



Step 9: Configure Multiple Rules

You can configure each Filter with multiple rules or actions by clicking the plus sign next to the first rule to add a second rule.

In the screenshot, you will see that I can add a second Rule Match Criteria to send a slight variation of the email address to the Junk filter as well.

When using multiple rules, you will have another Operator option. In this case, I have set “or” so that either of the email address is caught.


Step 10: Click ‘Create’ to create the filter

  • The final step is to click the Create button.

You will then see a confirmation message.


About us


We are a web development agency located in Cape Town, South Africa. We design great looking websites. We are CSS enthusiasts. We specialise in Content management systems. We are a professional Team with over 30 years of experience. Learn more.


facebook  linkedin  twitter  linkedin