On Tue, Sep 21, 2004 at 01:08:55PM -0500, Gabriel Millerd wrote:
> On Tue, 21 Sep 2004 12:42:29 -0500, Michael Parker <[EMAIL PROTECTED]> wrote:
> > 
> > It is also pretty easy to use the SA API to script this sort of
> > behavior.  I've got several scripts that given a username/IMAP mailbox
> > it will fetch mail, learn/report it (either as spam or ham), remove
> > the SA markup and save it in a local corpus for mass-checks.
> > 
> 
> are you using the $f->learn method primarily for this? minus any prep
> work like header removal and reporting.


Yeah, here is a piece from my spam-learn script:
*WARNING* This is against the 3.0 API

    my $raw_message = $imap->message_string($m);
    $raw_message =~ s/\r\n/\n/g;
    my $mail = $spamass->parse($raw_message);

    my $status = $spamass->learn($mail, undef, 1);

    if (!$status->did_learn()) {
        $imap->move($spamerrfolder,$m);
        $errcount++;
    }
    else {
        $imap->move($spamrptfolder,$m);
        $lrncount++;
    }


Michael

Reply via email to