The pop3filter Manual
Most of the configuration sits in the file spamtokens.py
. You can edit the following variables, in valid python syntax:
# list of spam blacklists. You can add your own if you wish BLACKLIST_DOMAINS = [ 'spews.relays.osirusoft.com', 'dns.rfc-ignorant.org', ... ]
This is the list of DNSBL you want to use. Read here for a comparison of various blacklists you might want to use.
# list of IP addresses that will not be checked. BLACKLIST_IGNORE = [ '127.0.*', '10.*', ('212.14.77.97','212.14.77.126'), ]
A list of IP addresses that you don't want to block. IP-Address rules can be:
- A fully qualified domain name (e.g. "some.domain.com")
- A fully qualified IP address (e.g. "127.0.0.1")
- A partially qualified IP address using wildcards * (any number of characters) and ? (any single character) (e.g. "64.0.0.*")
- If the expression starts with $, it is interpreted as a python regular expression. Refer to the Python Regular Expression Howto for an explanation of Python RE syntax.
- An IP range. Both start and end of the IP range must be fully qualified IP addresses (e.g. "(212.0.0.0-212.0.0.255)")
# All email addresses in this list will be ignored and not filtered. # These email addresses are also allowed to send HTML mail IGNORE_THESE_SENDERS = [ ]
When pop3filter processes mail, it first checks if the mail is on any of the IGNORE rules. This way, you can make sure your personal contacts to not get filtered. You can use the following expressions here:
- If the rule starts with !bf:, it is interpreted as a brainfuck expression and interpreted. If the code results in any output whatsoever (that is, if the '.' instruction gets called), the rule matches; if the code does not produce any output, the rule doesn't match.
- If the rule starts with a $, the rest of the rule is interpreted as a Python Regular Expression.
- If the rule includes a * or a ?, it will be matched like a filename.
- Otherwise, the rule will must be an exact (lowercase) match.
Note: All rules in pop3filter that are not IP addresses work like this.
IGNORE_THESE_RECEIVERS = [ ]
You can add a list of receivers here, that if specified will cause the mail to be ignored by pop3filter.
IGNORE_THESE_SUBJECTS = [ "fax empfangen" ]
You can add a list of subjects here, that if found will cause the mail to be ignored by pop3filter. In the example, the Fax mails from our server are ignored, because they have a fixed subject. Note: It is probably better to not use subjects as ignore filter rules.
# this is a list of header keywords, with associated rule tables IGNORE_RULES = { 'subject' : IGNORE_THESE_SUBJECTS, 'from' : IGNORE_THESE_SENDERS, 'to' : IGNORE_THESE_RECEIVERS, }
As you can see, the actual keywords used for the IGNORE processing is configurable. If, for example, you want to exclude messages from a specific host with a proper message ID, you could add
'message-id' : IGNORE_THESE_MESSAGE_IDs
and supply a list of message ID patterns to be ignored.
FILTER_THESE_SENDERS = [ "*.tw", "undisclosed recipients", ]
This is my personal remove list for contacts. Any mail which fits this sender description will be marked as spam. Others may use more relaxed rules (especially, if you live in taiwan or russia).
FILTER_THESE_RECEIVERS = [ "undisclosed recipients", ]
If any of these receivers match, the message will be marked as spam.
FILTER_THESE_MESSAGE_IDS = [ "*.tw", ]
If the message-ID matches taiwan or russia, the message will be marked as spam. Others may use more relaxed rules (especially, if you live in taiwan or russia).
FILTER_THESE_SUBJECTS = [ ]
You can add specific subject patterns here to mark messages as spam.
FILTER_THESE_ADDRESSES = [ ]
You can add specific IP addresses (or IP address ranges, see above) here; if a message uses these, it will be marked as spam.
# this is a list of header keywords, with associated rule tables FILTER_RULES = { 'subject' : FILTER_THESE_SUBJECTS, 'from' : FILTER_THESE_SENDERS, 'to' : FILTER_THESE_RECEIVERS, 'message-id': FILTER_THESE_MESSAGE_IDS, }
Again, as with the IGNORE_RULES, you can add your own filter rules here.
# these tokens, if found in the Subject: line, will indicate spam mail FILTER_SUBJECT_TOKENS = ['lowest', 'rate', 'mortgages', 'registered', 'analyst', 'invest', 'information', ...
A list of subject tokens that if found, will result in the message being tagged as spam.
Using HAMSTER rules
You can use a HAMSTER rules file, for example the one provided at http://spamabwehr.sakrak.net/spam-filter/ if you edit the registry entry
HKEY_LOCAL_MACHINE\Software\p-nand-q.com\HAMSTER_RULES