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

I'm using sa-learn which is part of SpamAssassin. I've looked through the documentation for the module but have not found anything helpful in regards to using sa-learn. All my script has to do is learn a file as ham, or learn a file as spam. Perhaps I'm using the wrong module? The only line in the doc that comes close is:

$status = $f->learn ($mail, $id, $isspam, $forget)

This looks like somewhat the direction I'm going but does anybody have experience using such a module? Or can someone give me an example? I'm thinking $isspam is a boolean, the documentation mentions about whether it is set or not. Thanks for input.

  • Comment on using Mail::SpamAssassin module, using sa-learn without system calls?
  • Download Code

Replies are listed 'Best First'.
Re: using Mail::SpamAssassin module, using sa-learn without system calls?
by gellyfish (Monsignor) on Aug 15, 2006 at 18:03 UTC

    The Mail::SpamAssassin::PerMsgLearner SYNOPSIS is basically a complete example. $mail should contain your entire mail message, $id should be either undef or a unique id of your own providing to identify the message (if it is undef then the message-id from the mail message will be used.) $isspam should be 1 if you want the message to be learned as spam or 0 if you want it to be learned as ham. YOu can omit the $forget or provide 0, if it is 1 then the message will un-learned rather than learned. The  $status->did_learn(); will return a true value if the message was actually learned: it might be not learned if the message was already seen for instance.

    /J\