What you need to know to program email filters. (Assuming you have programming skills). This draft faq covers cpanel email filtering, not the Box Trapper facility. Amongst other things it shows you how to implement a whitelist facility.
I have tried to make the guidelines below helpful, but they may have inaccuracies - please do say if you find any.
1. In the latest version of the cpanel software email filtering is accessed from the main cpanel interface. Filter sets can be defined for 'all email addresses' - this is called account level, or 'specific email addresses' - this is called user level. In older versions of the cpanel software rules for specific accounts are created via the Horde screen when you log in to the account.
2. Filter sets are evaluated from top to bottom. What controls what is at the top? They are ordered alphabetically by action - you can use this fact to crudely control execution order.
3. Only one filter ever fires per filter set. Any email that matches no filters 'drops through' to the normal destination email account
4. According to Zen support, Spam Assassin related conditions do not work - even though the documentation suggests that they do.
5. Filters consist of a condition part and an action part. When creating a condition the most flexible approach is to test 'any header' for matches to regular expressions. The regular expresssion language uses the Perl Compatible Regular Expression syntax. There are many web resources on this syntax - here is a starter http://www.webcheatsheet.com/php/regular_expressions.php. It appears regular expressions can be quite long - I got to 3k characters without objection. Some versions of the cpanel software do not allow you to edit the field in which you enter the expression, to get round this prepare your expressions in an external text editor and paste them in.
6. Actions are fired when conditions are met. Filters include a fairly wide range of actions: pipe to program, error messages, redirect to email, redirect to wemail folder, stop processing (& pass mail), discard. In newer versions of the cpanel software, actions are selected from a menu. In older versions of the cpanel software, actions in 'all email address' level filters have to be input in text - limited hints as to syntax are provided, but this can be guessed from the drop down menus provided for the 'specific email address' level filters.
7. CAUTION! - email filtering is powerful, but user-unfriendly - you may lose emails or cause other problems if you make mistakes - so test any rules well before rolling out. To avoid the risk of losing email, avoid using the discard action - instead forward email you want to discard to a webmail folder or email account that you can check from time to time.
8. Here is a workable sample 3 filter set based on the above. First filter is a whitelist. Subsequent filters test the Zen spam score in the messages header. You can use rules in your email client (eg MS Outlook 2003/7 rules) to process mail into mail client folders depending on the account they are send to under "Action". Note the rather strange account names - designed to ensure rules sort in, and are thus executed in, the right order.
CONDITION ACTION
| message_headers matches freddy@hotmail|martha@hotmail |
AndNotASpam@yourdomain.co.uk |
| message_headers matches X-Zen-Test-Spam-Score: [3][0-9]{1,2} |
PerhapsSpam@yourdomain.co.uk |
| message_headers matches X-Zen-Test-Spam-Score: [4-9][0-9]{1,2} |
YesSpam@yourdomain.co.uk |