You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Gabriel Millerd <gm...@gmail.com> on 2004/09/21 18:38:47 UTC

spamd + mysql woes

I run spam assassin from within exim for my users, all their data in
stored privately within mysql (bayes, awl, userprefs) and it works
GREAT. Fast clean and secure.

However before i switched to virtual hosting i allowed people to copy
false positives and negatives into special imap folders, then i had a
cron job that went through those folders and made the sa-learn
adjustments.

What is the best way to redeploy this crawling behavior? Is it even
possible right now?

I am running SA 3.0rcX right now. If i need to switch to a different
version I would be willing to.

Re: spamd + mysql woes

Posted by Michael Parker <pa...@pobox.com>.
On Tue, Sep 21, 2004 at 05:53:21PM -0500, Gabriel Millerd wrote:
> > >
> > > 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
> > 
>    i follow you completely, however how are you connecting to the
> mysql storage 'factory'? i have pretty much the same code you have.
> however i am assuming that the $spamtest was constructed not via
> Mail::SpamAsssassin->new() but rather by a different method.
> 

With a properly configured SA install it should just work:

my $spamass = Mail::SpamAssassin->new( { 'debug' => $debug } );
$spamass->init(1);

You can pass in an optional username, for instance:

my $spamass = Mail::SpamAssassin->new( { 'debug' => $debug,
                                         'username' => 'foo@bar.com'  } );
$spamass->init(1);


Now, I've never done that with userprefs in SQL, mileage may vary.
Guess I should research that a little before ApacheCon....

Michael


Re: spamd + mysql woes

Posted by Gabriel Millerd <gm...@gmail.com>.
> >
> > 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
> 
   i follow you completely, however how are you connecting to the
mysql storage 'factory'? i have pretty much the same code you have.
however i am assuming that the $spamtest was constructed not via
Mail::SpamAsssassin->new() but rather by a different method.

Re: spamd + mysql woes

Posted by Michael Parker <pa...@pobox.com>.
On Tue, Sep 21, 2004 at 01:08:55PM -0500, Gabriel Millerd wrote:
> On Tue, 21 Sep 2004 12:42:29 -0500, Michael Parker <pa...@pobox.com> 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

Re: spamd + mysql woes

Posted by Gabriel Millerd <gm...@gmail.com>.
On Tue, 21 Sep 2004 12:42:29 -0500, Michael Parker <pa...@pobox.com> 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.

Re: spamd + mysql woes

Posted by Michael Parker <pa...@pobox.com>.
On Tue, Sep 21, 2004 at 11:38:47AM -0500, Gabriel Millerd wrote:
> 
> However before i switched to virtual hosting i allowed people to copy
> false positives and negatives into special imap folders, then i had a
> cron job that went through those folders and made the sa-learn
> adjustments.
> 
> What is the best way to redeploy this crawling behavior? Is it even
> possible right now?
> 

I assume you're referring to this:
http://bugzilla.spamassassin.org/show_bug.cgi?id=3766

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.

Michael