#!/usr/bin/perl -w -T use strict; use File::Spec; my $PREFIX = '@@PREFIX@@'; # substituted at 'make' time my $DEF_RULES_DIR = '@@DEF_RULES_DIR@@'; # substituted at 'make' time my $LOCAL_RULES_DIR = '@@LOCAL_RULES_DIR@@'; # substituted at 'make' time use lib '@@INSTALLSITELIB@@'; # substituted at 'make' time BEGIN { # Locate locally installed SA libraries *without* using FindBin, which generates # warnings and causes more trouble than its worth. We don't need to be too # smart about this BTW. my @bin = File::Spec->splitpath($0); my $bin = ($bin[0] ? File::Spec->catpath(@bin[0..1]) : $bin[1]) # /home/jm/foo -> /home/jm || File::Spec->curdir; # foo -> . # check to make sure it wasn't just installed in the normal way. # note that ./lib/Mail/SpamAssassin.pm takes precedence, for # building SpamAssassin on a machine where an old version is installed. if (-e $bin.'/lib/Mail/SpamAssassin.pm' || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm') { # These are common paths where the SA libs might be found. foreach (qw(lib ../lib/site_perl ../lib/spamassassin ../share/spamassassin/lib)) { my $dir = File::Spec->catdir($bin, split('/', $_)); if(-f File::Spec->catfile($dir, "Mail", "SpamAssassin.pm")) { unshift(@INC, $dir); last; } } } } require Mail::SpamAssassin::CmdLearn; exit Mail::SpamAssassin::CmdLearn::cmdline_run ({ forget => 1 }); # --------------------------------------------------------------------------- =head1 NAME sa-forget - train spamassassin to forget about a mail =head1 SYNOPSIS B [options] --file I B [options] --mbox I B [options] --dir I B [options] --single < I Options: -f file, --folders=file Read list of files/directories from file --dir Learn a directory of RFC 822 files --file Check a file in RFC 822 format --mbox Check a file in mbox format --showdots Show progress using dots --no-rebuild Skip building databases after scan -C file, --config-file=file Path to standard configuration dir -p prefs, --prefs-file=file Set user preferences file -a, --auto-whitelist Use auto-whitelists --whitelist-factory Select whitelist factory -D, --debug-level Print debugging messages -V, --version Print version -h, --help Print usage message =head1 DESCRIPTION Given a set of mail messages which SpamAssassin has previously 'learnt' from, this command will tell it to 'forget' about those mails. See B for more details, and an introduction to the use of Bayesian filtering in SpamAssassin. =head1 OPTIONS =over 4 =item B<-a>, B<--auto-whitelist> Use auto-whitelists. While learning, add addresses to the auto-whitelist as appropriate. =item B<-h>, B<--help> Print help message and exit. =item B<-C> I, B<--config-file>=I Read configuration from I. =item B<-p> I, B<--prefs-file>=I Read user score preferences from I. =item B<-D>, B<--debug-level> Produce diagnostic output. =item B<-M> I, B<--whitelist-factory>=I Select alternative whitelist factory. =item B<--no-rebuild> Skip the slow rebuilding step which normally takes place after changing database entries. If you plan to scan many folders in a batch, it is faster to use this switch and run B once all the folders have been scanned. =back =head1 INSTALLATION The B command is part of the B Perl module. Install this as a normal Perl module, using C, or by hand. =head1 ENVIRONMENT No environment variables, aside from those used by perl, are required to be set. =head1 SEE ALSO Mail::SpamAssassin(3) spamassassin(1) sa-learn-spam(1) sa-learn-nonspam(1) sa-learn-rebuild(1) sa-forget(1) =head1 AUTHOR Justin Mason Ejm /at/ jmason.orgE =cut