Here we show some examples of real life
rule scripts from the area of mail
filtering.
First a rule set to sort mail into
MH folders based upon the mailing list
they are coming from.
Example
|
::fmail::def mailinglists {
on {[input header X-loop ~ alug@scp.de]} do {store2mh-folder List/ALUG; stop}
on {[input header X-from_ ~ nmh]} do {store2mh-folder Mail/nmh-list; stop}
on {[input header X-from_ ~ exmh]} do {store2mh-folder Mail/exmh-list; stop}
on {[input header X-from_ ~ w-sec-request]} do {store2mh-folder List/Security; stop}
on {[input header X-from_ ~ pgplib-dev]} do {store2mh-folder List/Security/PGPlib; stop}
on {[input header X-from_ ~ owner-g10]} do {store2mh-folder List/Security/GPG; stop}
on {[input header X-loop ~ gnupg]} do {store2mh-folder List/Security/GPG; stop}
on {[input header X-mailing-list ~ tix]} do {store2mh-folder Tcl/c-libs/Tix; stop}
on {[input header X-mailing-list ~ tcl-i18n]} do {store2mh-folder Tcl/i18n; stop}
on {[input header X-mailing-list ~ tclr]} do {store2mh-folder Tcl/TclTeam/tclr; stop}
on {[input header X-mailing-list ~ f-cpu]} do {store2mh-folder List/fcpu; stop}
on {[input header X-mailing-list ~ tclxml]} do {store2mh-folder Tcl/TclTeam/XML; stop}
on {[input header X-mailing-list ~ tkgs]} do {store2mh-folder Tcl/TkGS; stop}
on {[input header subject ~ tcl-i18n]} do {store2mh-folder Tcl/i18n; stop}
on {[input header X-from_ ~ owner-mysql]} do {store2mh-folder List/MySQL; stop}
on {[input header X-from_ ~ pilot-unix]} do {store2mh-folder List/pilot; stop}
on {[input header X-loop ~ itcl@tcltk.com]} do {store2mh-folder Tcl/iTcl; stop}
on {[input header X-mailing-list ~ all@westend]} do {store2mh-folder westend; stop}
on {[input header Mailing-list ~ ttdp]} do {store2mh-folder Tcl/TTdp; stop}
on {[input header Mailing-list ~ elmo]} do {store2mh-folder Tcl/TclTeam/ELMO; stop}
on {[input header subject ~ elmo]} do {store2mh-folder Tcl/TclTeam/ELMO; stop}
on {[input header Errors-to ~ owner-pleb]} do {store2mh-folder List/Pleb; stop}
on {[input header To ~ colossus]} do {store2mh-folder Tcl/colossus; stop}
on {[input header To ~ minotaur]} do {store2mh-folder Tcl/colossus; stop}
on {[input header Subject ~ WWWOFFLE]} do {store2mh-folder Linux/wwwoffle; stop}
}
|
|
And now sorting into folder based upon
the topic addressed in the subject.
Example
|
::fmail::def bytopic {
on {[input header subject ~ test]} do {store2mh-folder junk; stop}
on {[input header subject ~ Test]} do {store2mh-folder junk; stop}
on {[input header subject ~ pitcl]} do {store2mh-folder Tcl/TclTeam/palmtcl; stop}
on {[input header subject ~ tclr]} do {store2mh-folder Tcl/TclTeam/tclr; stop}
on {[input header to ~ tclteam]} do {store2mh-folder Tcl/TclTeam/; stop}
on {[input header cc ~ tclteam]} do {store2mh-folder Tcl/TclTeam/; stop}
on {[input header subject ~ memchan]} do {store2mh-folder Tcl/c-libs/memchan; stop}
on {[input header subject ~ pool]} do {store2mh-folder Tcl/Pool; stop}
on {[input header subject ~ autodoc]} do {store2mh-folder Tcl/Autodoc; stop}
on {[input header subject ~ trf]} do {store2mh-folder Tcl/c-libs/Trf; stop}
on {[input header subject ~ img]} do {store2mh-folder Tcl/c-libs/Img; stop}
on {[input header subject ~ arch.clt]} do {store2mh-folder bluepeak/newsmaster; stop}
on {[input header subject ~ tcl]} do {store2mh-folder Tcl; stop}
on {[input header subject ~ cgi_lib]} do {store2mh-folder Tcl; stop}
on {[input header subject ~ welcomebot]} do {store2mh-folder Tcl/TclTeam/bot.response; stop}
on {[input header subject ~ book]} do {store2mh-folder Tcl/Book; stop}
on {[input header subject ~ wwwoffle]} do {store2mh-folder Linux/wwwoffle; stop}
on {[input header subject ~ eten]} do {store2mh-folder Tcl/TclTeam/ETEN; stop}
on {[input header subject ~ ETEN]} do {store2mh-folder Tcl/TclTeam/ETEN; stop}
}
|
|
Or the person the mail came from:
Example
|
::fmail::def byaddress {
# ** administrivia **
on {[input header from ~ MAILER-DAEMON]} do {store2mh-folder bluepeak/postmaster; stop}
on {[input header to ~ postmaster]} do {store2mh-folder bluepeak/postmaster; stop}
on {[input header to ~ newsmaster]} do {store2mh-folder bluepeak/newsmaster; stop}
on {[input header to ~ news]} do {store2mh-folder bluepeak/newsmaster; stop}
on {[input header to ~ root]} do {store2mh-folder bluepeak/root; stop}
}
|
|
At last a high level rule script using
some of the example rule sets defined
above.
Example
|
::fmail::def main_rules {
always process mailinglists
always process spamblock
#always vacation
always process bytopic
always process byaddress
default store2mh-folder inbox
}
|
|
|