geetha has asked for the wisdom of the Perl Monks concerning the following question:

Hi ,, In my project I am going to send newsletters to our clients. Here I need to validate my newsletter(content) using perl. I need the check the spam score for only body content not header. I have tried with SA-3.2 it will check both header and body of the newsletter. Also I need to show the content's Spam score. thanks

Replies are listed 'Best First'.
Re: spam content checker
by CountZero (Bishop) on Jan 21, 2008 at 12:30 UTC
    Mail::SpamAssassin::PerMsgStatus has a $score = $status->get_body_only_points() method.

    That should do just what you are looking for.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      Hi, Thanks for your reply. I have installed the SA-3.2.4 and found the PerMsgStatus module also. I do not know, how to optimizing the perl modules. Here I need to call only the object-get_body_only_points(). Please help me. Thanks Geetha
        Did you read the documentation for this module? The synopsis has a comprehensive example.
        my $spamtest = Mail::SpamAssassin->new(); my $mail = $spamtest->parse($message); my $status = $spamtest->check($mail); my $score = $status->get_body_only_points();

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: spam content checker
by moritz (Cardinal) on Jan 21, 2008 at 10:07 UTC
    You can use SA, parse the result and ignore all header-related scores.

    SA gives you a detailed list about which checks identified a message as spam.

Re: spam content checker
by jettero (Monsignor) on Jan 21, 2008 at 11:34 UTC

    Hopefully, most people are using the bayes system in the spamassassin these days (or just gmail); so, hopefully your "newsletter" gets filtered properly anyway.

    UPDATE: I'm sad that I used the word twice like that. I'm also sad that the state of email today means that a high percentage of legitimate mail is blocked in the effort to block spam. However, I do find it rather unlikely that a legitimate mailing would need to spend so much time tweaking the scores. If it does, then the spamassassin isn't doing the job it promised — so perhaps it is doint it's job.

    -Paul

      You clearly have not had to deal with your legitimate bulk email not reaching the hopefully1 waiting recipients.

      1Sorry; I'd have liked to have balanced things out, but couldn't manage to use the word correctly twice in the same sentence.