Using the procedure "learnspams"

Ray Ballisti, last rev.: 1st December 2003

Content:

  1. Introduction
  2. Using "learnspams"
  3. The ~/.learnspamsrc file

1- Introduction: Defense against SPAMs

To take advantage of the learning algorithm in the new version of "spamassassin" we have to teach it.
For this reason everyone should create two mail folders in his mail subrirectory (default is "~/mail_folders") in which you can put those mails that you consider SPAMs in one folder while the "non_spams" go in the other one. As default we call those folders spams and hams.

For your convenience I wrote a procedure called learnspams which teach the spamassassin algorithm and empties the two folders.
What you have to do is to fill in those two folders with the appropriate mails (the good one and the bad one).
 

2- Using "learnspams"

  1. First time that you use it:
  2. Call the procedure:
    This procedure understand the following parameters:

    -h                    print this HELP
    -v                    verbose
    -t file_name          name of the template (empty) mail_file
    -maildir mail_dir     mail_subdirectory in your Home_directory
    -spams file_name      name of the mail_folder with SPAMS mails
    -hams  file_name      name of the mail_folder with 'good' mails
    

    Example:

    sirrah.ee.ethz.ch:ballisti:[ballisti]:104 % learnspams -v
    MAILDIR=mail_folders
    SPAMS=spams
    HAMS=hams
    learning SPAMS from /home/ballisti/mail_folders/spams
    Learned from 40 message(s) (264 message(s) examined).
    Emptying file /home/ballisti/mail_folders/spams 
    learning HAMS from /home/ballisti/mail_folders/hams
    Learned from 19 message(s) (32 message(s) examined).
    Emptying file /home/ballisti/mail_folders/hams 
    End of procedure "learnspams".
    Please continue to put mails into spams and hams 
    

    You can put this procedure call in your cronjob list:
    there is no problem when the files spams and hams are empty.

    Example:

    bigbang:ballisti:[ballisti]:91 % crontab -e
    bigbang:ballisti:[ballisti]:92 % crontab -l
    05 07 * * 1     /usr/local/bin/learnspams -v
    

3- The ~/.learnspamsrc configuration file

The syntax is:   variable_name = value    where value is a string

This file can have the following entries:

MAILDIR=mail_folders
SPAMS=spams
HAMS=hams
VERBOSE=no
TEMPLATE=template

None of them are compulsory. You can have only one line or more.
Lines beginning with a "#" in the first column are considered as comments.
Blanks do not matter: 'SPAMS=spams' is equivalent to 'SPAMS  =  spams'