You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Luke Shannon <i_...@yahoo.ca> on 2006/04/10 17:35:43 UTC
Using SpamAssassin In Perl
Hello;
Our company newsletter is not getting to some of our subscribers.
My guess is it is ending up in junk mail folders.
We have a section on relationship tips and I am concerned some of the content in this section could be triggering spam filters.
I am working on a script that runs SpamAssassin on an uploaded text version of the letter so I can scan the content.
What I would love is a report flagging content that might be causing a problem (and the overall score) so I can send the letter back to the creative team showing them the exact content that needs to be rewritten/removed.
Below is the script I have started. I am not sure what the spamassissin report should look like, but what I am getting back can't be it (It just gives me the version of spam assassin and the name of the file).
I am not experienced in Perl so it could easily be a problem with my code.
Is there any easier way to get a report on an email?
What is a good online reference for understanding the SpamAssassin API?
Thanks,
Luke
#!/Perl/bin/perl
use strict;
use CGI qw(:standard);
use Mail::SpamAssassin;
# get a parameter from a form
my $fulltext = param('fulltext') || 'no text supplied';
#create an array from the text in the file
my @lines = split(/\n/, $fulltext);
#create a test
my $spamtest = Mail::SpamAssassin->new( );
#create a new mail object
my $mail = $spamtest->parse(\@lines);
#create a status object
my $status = $spamtest->check($mail);
# output a document
print header( ), start_html("Spam Assasin Report"),
p("SpamAssassin Report: ", tt(escapeHTML($status->rewrite_mail())),
end_html( );
---------------------------------
Enrich your life at Yahoo! Canada Finance