spam assassin - running

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
i'm just started to learn Perl language.

I'm trying to run Spam Assasin, my environment:
w2k, ActivePerl v5.6.1, SpamAssassin version 2.63,

i can run SA as standalone module from command line:
perl e:/apps/SpamAssassin/spamassassin -e -t < "email.file" > "email_out.file"

Now, i'm trying to run SA from my own script:

use strict;

use Mail::SpamAssassin;
use Mail::SpamAssassin::NoMailAudit;

my $file = 'spam.txt';        # Name the file
open(INFO, $file);        # Open the file
my @lines = <INFO>;        # Read it into an array
close(INFO);            # Close the file
print @lines;    

my %parameters=( 'message', \@lines );
print "mail new...\n";
my $mail = Mail::SpamAssassin::NoMailAudit->new( %parameters );   # it stops
here !
print "spamtest new...\n";
my $spamtest = Mail::SpamAssassin->new();
print "check...\n";
my $status = $spamtest->check( $mail );

and the script stops in line where $mail object is created,
i think that it want to read email from STDIN, because when i hit ^Z char, the
program is

This is a description of NEW SpamAssassin:Message

Creates a Mail::SpamAssassin::Message object. Takes a hash reference as a
parameter. The used
hash key/value pairs are as follows:
message is either undef (which will use STDIN), a scalar of the entire message,
an array reference
of the message with 1 line per array element, or a file glob which holds the
entire contents of the

I understood that if i pass 'message' key with reference to array ( \@lines ) in
hash, it will be used
as a source for email.

Dow you know what's wrong ?
Thanks for help in advance.

see ya

Re: spam assassin - running

On Wed, 17 Nov 2004 11:57:04 +0000, lukes wrote:

> hello,
Hello :-)
> my $mail = Mail::SpamAssassin::NoMailAudit->new( %parameters );   # it
> Takes a hash reference as a parameter.

You are not passing a hash reference, you are passing a hash. You want:

my $mail = Mail::SpamAssassin::NoMailAudit->new( \%parameters );


Site Timeline