You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Phil Dibowitz <ph...@ipom.com> on 2007/04/16 09:27:44 UTC

spamc and Mail::SpamAssassin::Client don't return same result

I'm trying to use Mail::SpamAssassin::Client in my code, but I get very
different results using it than I do when I use spamc.

With spamc I get 5.7 points, but with Mail::SpamAssassin::Client I get 3.2
points.

Here's a very simple example to illustrate this:

Here's the test spam:

------------------------------------
Well done!
http://amcvuhwk.com/qeix/uopk.html | http://mtldkvuq.com/eojy/hyia.html
------------------------------------


Here's what happens with spamc:

[phil@alt tmp]$ cat /tmp/spam | spamc
X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on alt.home.pv
X-Spam-Level: *****
X-Spam-Status: No, score=5.7 required=6.0 tests=EMPTY_MESSAGE,MISSING_HB_SEP,
        MISSING_HEADERS,MISSING_SUBJECT,NO_RECEIVED,NO_RELAYS,TO_CC_NONE
        autolearn=no version=3.1.7-deb
Well done!
http://amcvuhwk.com/qeix/uopk.html | http://mtldkvuq.com/eojy/hyia.html
[phil@alt tmp]$


Here's what happens with a small test script that uses
Mail::SpamAssassin::Client:


[phil@alt tmp]$ /tmp/test.pl
Score is 3.2
Message was X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on
alt.home.pv
X-Spam-Level: ***
X-Spam-Status: No, score=3.2 required=6.0 tests=EMPTY_MESSAGE,MISSING_HEADERS,
        MISSING_SUBJECT,NO_RECEIVED,NO_RELAYS,TO_CC_NONE autolearn=no
        version=3.1.7-deb
Well done!
http://amcvuhwk.com/qeix/uopk.html | http://mtldkvuq.com/eojy/hyia.html
[phil@alt tmp]$


And here's the test script:

-------------------------------------------------
#!/usr/bin/perl

use strict;
use warnings;
use Mail::SpamAssassin::Client;

my $spamc = new Mail::SpamAssassin::Client({    port => 783,
                                                username=> 'phil',
                                                host => 'localhost'});

unless ($spamc->ping()) {
        die("Can't ping server");
}

open(M,"</tmp/spam") || die("Couldn't open file");
my $msg = join('',<M>);
close(M);

my $result = $spamc->process($msg);
print "Score is " . $result->{'score'} . "\n";
print "Message was " . $result->{'message'} . "\n";
-------------------------------------------------


I'm using SpamAssassin 3.1.7-2 on Debian unstable. Any help would be greatly
appreciated.

Thanks.
-- 
Phil Dibowitz                             phil@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming



Re: spamc and Mail::SpamAssassin::Client don't return same result

Posted by Phil Dibowitz <ph...@ipom.com>.
On Mon, Apr 16, 2007 at 08:30:01PM +0200, Magnus Holmgren wrote:
> I'm not completely sure why the perl module doesn't trigger that rule, byt 
> please try a test spam *with* a header.
> 
> | describe MISSING_HB_SEP  Missing blank line between message header and body

I'm actually using this to catch spam on non-email messages... I don't mind a
few points for the standard bad-headers, I can take this into account. But I'd
like to get consistent results first..

-- 
Phil Dibowitz                             phil@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming


Re: spamc and Mail::SpamAssassin::Client don't return same result

Posted by Magnus Holmgren <ho...@lysator.liu.se>.
On Monday 16 April 2007 09:27, Phil Dibowitz wrote:
> I'm trying to use Mail::SpamAssassin::Client in my code, but I get very
> different results using it than I do when I use spamc.
> [...]
> Here's the test spam:
>
> ------------------------------------
> Well done!
> http://amcvuhwk.com/qeix/uopk.html | http://mtldkvuq.com/eojy/hyia.html
> ------------------------------------
>
> [phil@alt tmp]$ cat /tmp/spam | spamc
> X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on alt.home.pv
> X-Spam-Level: *****
> X-Spam-Status: No, score=5.7 required=6.0
> tests=EMPTY_MESSAGE,MISSING_HB_SEP,
                      ^^^^^^^^^^^^^^
> MISSING_HEADERS,MISSING_SUBJECT,NO_RECEIVED,NO_RELAYS,TO_CC_NONE
> [...]
>
> [phil@alt tmp]$ /tmp/test.pl
> Score is 3.2
> Message was X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on
> alt.home.pv
> X-Spam-Level: ***
> X-Spam-Status: No, score=3.2 required=6.0
> tests=EMPTY_MESSAGE,MISSING_HEADERS,
> MISSING_SUBJECT,NO_RECEIVED,NO_RELAYS,TO_CC_NONE autolearn=no

I'm not completely sure why the perl module doesn't trigger that rule, byt 
please try a test spam *with* a header.

| describe MISSING_HB_SEP  Missing blank line between message header and body

-- 
Magnus Holmgren        holmgren@lysator.liu.se
                       (No Cc of list mail needed, thanks)