You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Matic Dolar <ma...@medium.si> on 2004/08/10 19:08:50 UTC

testing a whole mailbox

Hi!

I'm writing a study about spam and would like to do the following:
- run spamassassin against a whole mailbox file (presumably quite large one) full of mixed messages - both spam and ham (as well as a significant amount of viruses (albeit removed by antivirus-scanner).
- analyze the results I get - amount of spam received, amount of spam caught, etc ...

What command should I use to run spamassassin?
All I was able to achieve so far was to run it against a mailbox (plain text file) containing a single message. I want to make it analyze all the messages in the file, one by one. 

Any ideas on how I could make this work or perhaps other suggestions?
Everything would be greately appreciated!
Tnx!

Matic

Re: testing a whole mailbox

Posted by Mike Burger <mb...@bubbanfriends.org>.
I don't think that there's a flag to just run against a mailbox.  If I 
recall, correctly, you can just use "spamassassin < /path/to/mailbox" and 
it should read each message in that box, individually.

sa-learn, on the other hand, needs the --mbox flag for bayes training.

On Tue, 10 Aug 2004, Matic Dolar wrote:

> Hi!
> 
> I'm writing a study about spam and would like to do the following:
> - run spamassassin against a whole mailbox file (presumably quite large one) full of mixed messages - both spam and ham (as well as a significant amount of viruses (albeit removed by antivirus-scanner).
> - analyze the results I get - amount of spam received, amount of spam caught, etc ...
> 
> What command should I use to run spamassassin?
> All I was able to achieve so far was to run it against a mailbox (plain text file) containing a single message. I want to make it analyze all the messages in the file, one by one. 
> 
> Any ideas on how I could make this work or perhaps other suggestions?
> Everything would be greately appreciated!
> Tnx!
> 
> Matic

-- 
Mike Burger
http://www.bubbanfriends.org

Visit the Dog Pound II BBS
telnet://dogpound2.citadel.org or http://dogpound2.citadel.org

To be notified of updates to the web site, visit 
http://www.bubbanfriends.org/mailman/listinfo/site-update, or send a 
message to:

site-update-request@bubbanfriends.org

with a message of: 

subscribe

Re: testing a whole mailbox

Posted by Robert Menschel <Ro...@Menschel.net>.
Hello Matic,

Tuesday, August 10, 2004, 10:08:50 AM, you wrote:

MD> Hi!

MD> I'm writing a study about spam and would like to do the following:
MD> - run spamassassin against a whole mailbox file (presumably
MD> quite large one) full of mixed messages - both spam and ham (as well
MD> as a significant amount of viruses (albeit removed by
MD> antivirus-scanner).
MD> - analyze the results I get - amount of spam received, amount of spam caught, etc ...

MD> What command should I use to run spamassassin?

What you want is a mass-check run.

http://wiki.apache.org/spamassassin/MassCheck?action=highlight&value=mass-check

Bob Menschel




Re: testing a whole mailbox

Posted by William Stearns <ws...@pobox.com>.
Good day, all,

On Tue, 10 Aug 2004, LuKreme wrote:

> On 10 Aug 2004, at 11:08, Matic Dolar wrote:
> > - run spamassassin against a whole mailbox file (presumably quite 
> > large one) full of mixed messages
> 
> formail -s procmail -m sa.check < THE.MBOX

	There's an alternate form that will process each of the individual 
messages in the mailbox (calculating and adding the SpamAssassin score 
block) without requiring procmail or a procmail config file:

formail -f -ds /usr/bin/spamc <origfolder >folder.reprocessed

	This assumes you have spamd running.  If you don't, I believe you 
can simply substitute "spamassassin" for "spamc", although this will take 
longer per message because of the increased startup time.
	Note that LuKreme's approach with procmail will sort the mail into 
spam and ham folders, while the above will just place all messages in 
folder.reprocessed.  Depends on what you want.
	Cheers,
	- Bill

---------------------------------------------------------------------------
	bash$ :(){:|:&};:
	-- Michal Zalewski
(Courtesy of George Bakos.  _Don't_ run this.)
--------------------------------------------------------------------------
William Stearns (wstearns@pobox.com).  Mason, Buildkernel, freedups, p0f,
rsync-backup, ssh-keyinstall, dns-check, more at:   http://www.stearns.org
--------------------------------------------------------------------------

Re: testing a whole mailbox

Posted by Matic Dolar <ma...@medium.si>.
Thanks!!! This is exactly something I was looking for!
I'd just like to ask you one favor, if it isn't too much of a bother ...
Could you please explain what the lines in the script do (at least
approximatley), so I can play around with it?
Or could you at least point me in the right direction?

Thank you so much!

Matic

----- Original Message ----- 
From: "LuKreme" <kr...@kreme.com>
To: <sp...@incubator.apache.org>
Sent: Tuesday, August 10, 2004 9:19 PM
Subject: Re: testing a whole mailbox


> On 10 Aug 2004, at 11:08, Matic Dolar wrote:
> > - run spamassassin against a whole mailbox file (presumably quite
> > large one) full of mixed messages
>
> formail -s procmail -m sa.check < THE.MBOX
>
> sa.check:
>
> LOGFILE=the.mbox.log
> LOGABSTRACT=NO
> NL="
> "
> LONGDATE=`date "+%y-%b-%d %I:%m:%S %z"`
> TRAP='echo ""; formail -l "$LASTFOLDER" ;echo "    Spam: $SPAM
> Deliverd: $LONGDATE'
>
> :0fw
> | spamassassin
>
> :0
> * ^X-Spam-status:\/
> { SPAM=$MATCH }
>
> :0:
> * ^X-Spam-Status:(.*\<)?Yes
> SPAM.MBOX
>
> :0:
> HAM.MBOX
>
> > - analyze the results I get - amount of spam received, amount of spam
> > caught, etc ...
>
> The logfile will contain the basic details on every email grouped into
> a single block
>
>
> -- 
> Ah we're lonely, we're romantic / and the cider's laced with acid / and
> the Holy Spirit's crying, Where's the beef? / And the moon is swimming
> naked / and the summer night is fragrant / with a mighty expectation of
> relief
>



Re: testing a whole mailbox

Posted by LuKreme <kr...@kreme.com>.
On 10 Aug 2004, at 11:08, Matic Dolar wrote:
> - run spamassassin against a whole mailbox file (presumably quite 
> large one) full of mixed messages

formail -s procmail -m sa.check < THE.MBOX

sa.check:

LOGFILE=the.mbox.log
LOGABSTRACT=NO
NL="
"
LONGDATE=`date "+%y-%b-%d %I:%m:%S %z"`
TRAP='echo ""; formail -l "$LASTFOLDER" ;echo "    Spam: $SPAM
Deliverd: $LONGDATE'

:0fw
| spamassassin

:0
* ^X-Spam-status:\/
{ SPAM=$MATCH }

:0:
* ^X-Spam-Status:(.*\<)?Yes
SPAM.MBOX

:0:
HAM.MBOX

> - analyze the results I get - amount of spam received, amount of spam 
> caught, etc ...

The logfile will contain the basic details on every email grouped into 
a single block


-- 
Ah we're lonely, we're romantic / and the cider's laced with acid / and 
the Holy Spirit's crying, Where's the beef? / And the moon is swimming 
naked / and the summer night is fragrant / with a mighty expectation of 
relief

Re: testing a whole mailbox

Posted by Ryan Thompson <ry...@sasknow.com>.
Matic Dolar wrote to spamassassin-users@incubator.apache.org:

> Hi!
>
> I'm writing a study about spam and would like to do the following: -
> run spamassassin against a whole mailbox file (presumably quite large
> one) full of mixed messages - both spam and ham (as well as a
> significant amount of viruses (albeit removed by antivirus-scanner).
> - analyze the results I get - amount of spam received, amount of spam
> caught, etc ...

If you really want to do this right, you should use the tools in the
"masses" subdirectory of the SA distribution. You'll want to split the
mailboxes up into separate spam and ham corpora, and run mass-check on
each. From there, the spam.log and ham.log you obtain should tell you
almost everything you need to know.

http://wiki.apache.org/spamassassin/MassCheck

The masses stuff is designed with this purpose in mind. Although it is
tilted more toward rule analysis and scoring, those results are a
superset of most other results you might want to obtain, such as average
ham/spam scores, overall tagging accuracy, etc.

- Ryan

-- 
   Ryan Thompson <ry...@sasknow.com>

   SaskNow Technologies - http://www.sasknow.com
   901-1st Avenue North - Saskatoon, SK - S7K 1Y4

         Tel: 306-664-3600   Fax: 306-244-7037   Saskatoon
   Toll-Free: 877-727-5669     (877-SASKNOW)     North America

Re: testing a whole mailbox

Posted by Andy Jezierski <aj...@stepan.com>.



"Matic Dolar" <ma...@medium.si> wrote on 08/10/2004 12:08:50 PM:

> Hi!
>
> I'm writing a study about spam and would like to do the following:
> - run spamassassin against a whole mailbox file (presumably quite
> large one) full of mixed messages - both spam and ham (as well as a
> significant amount of viruses (albeit removed by antivirus-scanner).
> - analyze the results I get - amount of spam received, amount of
> spam caught, etc ...
>
> What command should I use to run spamassassin?
> All I was able to achieve so far was to run it against a mailbox
> (plain text file) containing a single message. I want to make it
> analyze all the messages in the file, one by one.
>
> Any ideas on how I could make this work or perhaps other suggestions?
> Everything would be greately appreciated!
> Tnx!
>
> Matic

Not sure 2.6x has that option, do a  man spamassassin  to be sure.

In 3.0 it's  spamassassin --mbox filename

Andy