With regard to email filters, these use the criteria specified by you for determining the way in which to handle email messages. The below-mentioned cPanel interfaces enable you to configure email filters.
The Global Email Filters interface. These email filters affect the email addresses of the cPanel account.
cPanel >> Home >> Email >> Global Email Filters
The Email Filters interface. A cPanel account’s specific email addresses get affected by user-level filters.
cPanel >> Home >> Email >> Email Filters
In the context of these interfaces, you need to click + to add a rule, or click – to remove rules.
To digress, since all this is in reference to cPanel, which is a web hosting control panel, let us touch upon web hosting before proceeding further. Web hosting is a service provided by web hosting companies for ensuring that websites are accessible over the Internet. It can be of many types. Terms such as, “Windows Hosting”, “Cloud Hosting”, “Reseller Hosting”, etc. are some of the terms that are related to the service of web hosting.
Filter Rules and Criteria
The first set of options is meant for specifying that part of the email message, which the system examines for determining if the message matches your filter parameters. You can select from the below-mentioned options.
From – It describes the address of the message sender.
Subject – It describes the subject line of the message.
To – It describes the address to which the sender sent the message.
It needs to be mentioned here that generally the recipient doesn’t receive the BCC field in the header of an email. That is why you can’t use the BCC field in a filter.
Reply Address – It specifies the address at which the sender receives the replies.
Body – It indicates the content of the message.
Any Header – It indicates any part of the header of the message.
Any Recipient – It indicates any recipient of the message.
Has not been previously delivered – Herein the system examines only those messages which are in the queue for delivery.
is an Error Message – Herein the system examines only error messages that are sent by an auto-response system.
List ID – It indicates the mailing lists of an account.
Spam Status – It indicates whether a message has been marked as spam by Apache SpamAssassin. The Spam Status line starts with Yes or No.
Spam Bar – It describes the content of the Spam Bar header that was generated by Apache SpamAssassin for the message. The more the (+) signs assigned to a message by Apache SpamAssassin, the more the likelihood of the message being marked as spam by the system.
Spam Score – It indicates the total number of (+) signs in the Spam Bar value. It is expressed as an integer.
Let us run you through the Spam Score section now, so that you can gain more information about the Spam Score option.
Spam Score
The below-mentioned options are applicable only when the Spam Score option has been selected.
is above (#s only) – It indicates that the Spam Score of the message is greater than the number specified by you.
is not above (#s only) – It indicates that the Spam Score of the message is either equal to or less than the number specified by you.
is below (#s only) –It indicates that the Spam Score of the message is lower than the number specified by you.
is not below (#s only) – It indicates that the Spam Score of the message is either greater than or equal to the number specified by you.
Operators
Once you have selected the portion of the email message that will be examined by the system, you need to select the type of comparison. This comparison is between the email’s that particular portion and the criteria entered by you.
The following options are available for you to choose from:
equals – It means that the message totally matches a defined string.
matches regex – It means that the message matches a regular expression that has been defined by you.
It needs to be mentioned here that the filter text box accepts regular expressions when this option has been selected.
contains – It indicates that the message contains a string that has been defined by you.
does not contain – It indicates that the message doesn’t contain the defined string.
begins with – It indicates that the message starts with the defined string.
ends with – It indicates that the message ends with the defined string.
does not begin – It indicates that the message does not begin with the defined string.
does not end with – It indicates that the message does not end with the defined string.
does not match – It indicates that the message doesn’t exactly match the defined string.
It needs to be mentioned that when a filter is created, which uses several operators, the system processes the “and” operator before the “or” operator.
Criteria
You need to enter the criteria to use in the text box, under the Rules menu. The type of data entered by you shall determine the comparison that the system carries out. One important point to note is that Exim converts newlines into spaces in the $message_body field. You should not add \n characters to any body filters that are created by you.
Actions
When it is determined by cPanel that an email message matches your filter, the message is handled in any of the below-mentioned ways that has been specified by you.
Discard Message – The incoming message is discarded by the system, with no failure notice.
Redirect to email – The message is forwarded by the system to another email address that has been specified by you.
Fail with message – The message is discarded by the system. It automatically sends a failure notice to the sender.
Stop Processing Rules – All filter rules are skipped by the system.
Deliver to folder – The message is delivered by the system to a specific folder.
Pipe to a program – The incoming message is sent by the system to a specified program.
More information about it has been provided in the below-mentioned section.
Pipe to a Program
First and foremost, you need to ensure that your script uses the proper file permissions (0700). In order to change the file permissions for your script, you need to run the chmod 0700 myscript.php command. In it, myscript.php represents the location of your script and file name.
You can use the Pipe to a Program option to parse, and enter email information into a different system.
STDIN pipes email and headers to the program.
Variables can be accepted by Pipes from the $_SERVER array, and variables on the command line.
Memory limit issues might be caused by the language or the environment that you use.
If any output is being produced by your script, even if it is a blank line, a bounce message containing that output will be created by the system.
When the Pipe to a Program option is being used, a path should be entered that is relative to your home directory.
If PHP is being used, you need to ascertain that your code is appropriately wrapped in start and end tags.
Comments