TISNOP mail filter                      2002 Dec 01

Version 0.0.1  - never tested in real life environment!

  problems:
    - how do I discard a mail (/dev/null)?
      the mail walks trough tisnop, what happens if nothing
      comes out at the other end?
    - multipart support not yet implemented.
    - what shall happen when a mail with wrong format arrives?
      e.g. a mulipart without closing tag? /dev/null?
    - more actions needed. Currently only header rewrite.


The ideas with tisnop are:
  - filtering with python regular expressions
  - easy configuration in python syntax
  - no cryptic letters to learn. (":0 Bf:" or ":0 :Bf"? :-) )

tisnop is two files:
  - tisnop      : python module
  - tisnop01.py : a mail filter

The configuration is rule based, whereas every rule
has a name, a list of conditions, and a list of actions.

Example:

import tisnop
...
c_texthtml = \
  tisnop.condition(
      "pure html mail",             # a name
      tisnop.HEADER,                # no tisnop.BODY at this time,,,
      "Content-type",               # field in header
      re.compile("text/html")  )    # a regexp

a_mark_spam = \
  tisnop.action(
      "MARK_SPAM",  tisnop.HEADER, "Subject", "SPAM: %S" )

tisnop1.addRule( "Only HTML Content"  , [c_texthtml], [a_mark_spam] )
...

tisnop.action()


Conclusion:
  - conditions and actions have four parameters
  - conditions use python regular expressions
  - everything has a name
  - You can use placeholders (%S %T %F %C %D)
  - there's no cryptic syntax to learn
  - implict "AND" operator in conditions list

Currently tisnop supports only HEADER based conditions and actions.

tisnop does not support things like "COND1 AND (COND2 OR COND3)".
You have to write two rules instead:
  add.Rule( "rule_1a", [COND1,COND2], [ACTION1] )
  add.Rule( "rule_1b", [COND1,COND3], [ACTION1] )

And there's no NOT operator!
To test that something is not in a field, write an appropiate regexp:
c_nomagic = re.compile("^(?!magic)")  # no ^magic (in Subject).

This is easier to implement and easier to learn.

File Type Size
 .  
    Amateur girls.mail?2.319
    html_and_multispace.mail?19.162
    tisnop.html?2.183
    tisnop.pypython source4.020
    tisnop01.pypython source1.676
    triple_num_and_multispace.mail?2.594