Creating user level filtering in cPanel

When receiving emails on the server, there may be a need for filtering specific email addresses that are coming into the server. Emails can be Discarded, sent to another email address, or delivered to a program with the User and Account Level Filtering. This tutorial will explain the Global and normal Email Filtering within the cPanel. If the previous tutorial was missed, please visit the Setting domain MX records to remote settings in cPanel tutorial.

Filtering emails on the User and Account level

  1. Log into your cPanel
  2. user-level-filtering-1-select-moodle

    For individual account level filtering Navigate to the Email > Email Filters in cPanel.

    user-level-filtering-4-account

    For global level filtering Navigate to the Email > Global Email Filters in cPanel.

  3. user-level-filtering-2-manage-moodle

    On the Email Filters page, click the Manage filters link in the row of the email account that is having filters set up.

  4. user-level-filtering-3-create-moodle

    The Edit Filters for [email protected] will open up. Click the Create a New Filter button to add email filters.

  5. user-level-filtering-5-click-moodle

    In this article, Yahoo.com will be used for the filter. The filter will send any emails from a Yahoo.com email address to the Junk folder. Set the Filter name, Rules, and Actions and click Create. The action in this case will be Junk. Below is a description of what each Option, Operator, and Action does.

    Email Filter Option Rules

    FromThis is for matching the from email address.
    SubjectThis will filter by the subject of the email.
    ToThis will filter the email by who it was sent to.
    Reply AddressFilters by the reply address to who the email will be replied to.
    BodyScans the text of the email for any matches and filters according to the text of the email..
    Any HeaderScans specific criteria found in the Headers of the email.
    Any RecipientLooks at all recipients of the email.
    Has not been previously deliveredFilters emails if they are still in Queue on the server..
    Is an error messageLooks at errors received by auto responders.

    Email Filter Operator Rules

    EqualsMatches exactly what is put in the box.
    Matches RegexA Regular Expression can be used here..
    ContainsWill match if the email has the string of characters in it.
    Does not ContainWill match if the email does NOT have the string of characters in it.
    Begins withBegins with the characters that were typed.
    Ends withEnds with the Characters that were typed.
    Does not begin withDoesn’t begin with the characters that were typed.
    Does not end withDoesn’t end with the Characters that were typed.
    Does not matchDoes not equal the characters typed.

    Email Filter Action Rules

    Discard MessageDeletes the message with no Failure message.
    Redirect to EmailSends the email to another email address.
    Fail with MessageDeletes the email and sends a failure message..
    Stop processing rulesDoes not run any filter rules.
    Deliver to folderSends the email to a specified folder.
    Pipe to programSends the email to a program or script on the server.

    user-level-filtering-6-success-moodle

    Once the filter is created there should be a “You have successfully created a new filter” message.

  6. user-level-filtering-7-final=moodle

    When visiting the Edit Filters section again, the new filter will be in the list of filters. Here is where the filter can be edited or removed.

  7. user-level-filtering-8-test-moodle

    Next the filter can be tested to see if its doing what is required. At the bottom of the edit filters section, change the To: and From: emails or the subject (depending on how you set up the filter) to test the filter. Click Test Filter.

  8. user-level-filtering-9-output-moodle

    The test filter will run and display on the Filter Trace page. In the Filter trace results: the message can be seen going to where the filter was set. In this case The message was Saved to the Trash..

This concludes the article for Creating user level filtering in cPanel. For more information on this course please visit Using Email – cPanel

4 thoughts on “Creating user level filtering in cPanel

    1. Hi Ebby, sorry to hear that you’re still running in to trouble with spam. Are items still coming through that are specifically blocked by the filter? I’d advise checking the mail logs, and check in with our live Support team if you wanted someone to double check the filters you set up. Hope that helps!

  1. These global email filters don’t work.  I set one up using Any Header Contains “spf+fail” > discard, and I am still getting emails that meet that criterion.  Namely, bitcoin sextortion emails coming from my own spoofed email address.

    1. Hello.

      I’m sorry to see that the global filters are not working for your email account. Do you have any other filters configured?

Was this article helpful? Join the conversation!