You can create an email email filters through your cPanel control panel which is where you manage your hosting account. Email filters can be set up to target specific word, subject, from or to. Emails that are filtered out can be sent to a different email, deleted, delivered to a folder or delivered to a program.
The first step is to log into your cPanel account. If you are unsure on how to do this, please view the following help article – ‘How to log into cPanel‘.
Click on the “Email Filters” icon on the cPanel dashboard.
Then click “Manage Filters” which is located to the right of the email address.
You can then create a new email filter by clicking the button highlighted in the image below.
Now you can choose the name of your filter. This name cannot contain “Rule #” or “Converted Rule”, and should be unique. If the name is not unique and is the same as another filter, the already existing filter will be overwritten.
Now the name of your filter has been chosen, you can configure your “From” rule. The options to choose from are listed below:
- 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).
You can now configure the operator rules, the options to choose from are listed below:
- 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.
Once you have chosen a rule option and rule operator, you need to choose what they will match. This can be a specific email, subject or key word.
The next step is to configure the action rules, the options you have for this are as follows:
- 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.
Each filter can be configure to include multiple rules, this can be done by clicking the plus sign next to the first rule to add a second.
When using a number of rules you will have more operator options. In the screenshot below, the operator has been set to “Or”. This will mean either of the email addresses are caught.
In the screenshot below, you can see that a second rule can be added to match the rule criteria, this will send a variation of the email address to the junk filter.
The final step is to simply click the Create Button, this will be followed by a confirmation message.
You have now created an Email Filter!
Global Email Filters
To start, click on “Global Email Filters” located within the email section of cPanel.
To get set up with Global Email Filters, please follow the instructions to set up Email Filters above. The steps are the same.