tickle

E-mail filter in Tcl

This page gives some explanation to an e-mail filter in Tcl. It is only useful for people who get their mail on a Unix/Linux machine. It allows you to filter spam and to distribute your mail to various mailboxes or folders. It also catches viruses. You need to have Tcl installed in your mail server. This program is provided as-is and no guarantee is given. Just uploaded version 0.2.

Instructions

  1. Download the Tcl source text by right-clicking here and put it in your home directory.

  2. Create a .forward file containing the following line, keeping the quotes (you may have to change the path to tclsh if it's different on your system.)
    "|/usr/local/bin/tclsh filter.tcl"
    If you want to experiment with it to make sure you don't lose any mail, then make a .forward file containing the following instead
    \username, "|/usr/local/bin/tclsh filter.tcl"
    where "username" is your username. Then you will continue to get your mail in your usual place as well as having it filtered.

    Alternatively,instead of creating a .forward file, create a .procmailrc file (assuming your system uses procmail) with the following content
    :0
    | /usr/local/bin/tclsh filter.tcl
    this will work just as before, with the advantage that you can run procmail based programs (such as spam assassin) alongside it.

  3. Edit the file filter.tcl to set your filtering criteria. There are some examples in the file to guide you. Basically you will fill in lists with undesirable e-mail addresses and subjects. The lists should conform to the pattern set there, namely the list is enclosed in braces, items are separated by spaces and lines in the middle terminate in a backslash (\). Make sure there are no characters (not even spaces) after the backslash. Right now the subject list is set to be case insensitive, while the others are case sensitive (i.e. distiguish between upper and lower case). This can be changed, if desired. The filter is set up to catch the Klez worm right now and has commented out options to catch the Nigerian scam and also messages with links to pictures on the web, so you can also customize these options.

  4. Right now the program is set up to put your mail in files called "inbox" and "spam". You can change that, if desired. If you use the standard Unix "mail" program you can then read your mail by issuing the command "mail -f inbox" at the prompt. Similarly for "elm" or "mutt". If you use "pine" then you should edit the file filter.tcl and replace "inbox" by something like "mail/inmbox" and so on. Note that I'm using "inmbox" and not "inbox", that's because pine seems to not like anybody but itself creating an "inbox" file. Netscape keeps mail at nsmail/Inbox and other files in the nsmail directory and is not as fussy as pine. If you use a different mailer you need to find out where to place the mail folders. If you're one of those perverted individuals who use a certain text editor to read e-mail, you're on your own.

  5. Another option is to use the filter to forward mail. You need to edit the file filter.tcl to add the email address and uncomment some lines. (BTW, lines that begin with a # in the file filter.tcl are comment lines which don't play a role. Some are actually lines of code that can be activated by removing the #.)

This page is maintained by Felipe Voloch

Other programs.

This page has been visited [an error occurred while processing this directive] times since Thursday, April 11th, 2002