Spamassassin.pm has a non public sub called init that is called internally from the "check" sub. init checks to see if the config files have been loaded yet. If they have been loaded it then proceeds on to screen the message for spam. If a config file has not been loaded, it loads it and overwrites any custom mail::spamassassin::conf variables with the defaults and the values from the config file. Thus the following code is ineffective.
my $spamtest = Mail::SpamAssassin->new(); $spamtest->load_scoreonly_sql($username); my $status = $spamtest->check($msg); $status->rewrite_mail(); $status->finish ();
by manually calling the non public "init" function via $spamtest->init(1); as show below, one forces spamassassin to load the config file and all defaults, then the load_scoreonly_sql function loads the appropriate rules and user prefs that are stored in the database. failure to do init(1) prior to load_scoreonly_sql results in mysql data being overridden by defaults and config file data.
my $spamtest = Mail::SpamAssassin->new(); $spamtest->init(1); $spamtest->load_scoreonly_sql($username); my $status = $spamtest->check_message_text($msg); $status->rewrite_mail(); $status->finish ();
If this is anywhere in the manual i'd be thrilled to see it, but given that init is not even mentioned as a method, i'd assume it's not.
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk