diff options
-rwxr-xr-x | oftc-listmod-learn-mail | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/oftc-listmod-learn-mail b/oftc-listmod-learn-mail index d8074f9..6f758af 100755 --- a/oftc-listmod-learn-mail +++ b/oftc-listmod-learn-mail @@ -34,18 +34,26 @@ check_maildir HAMOUT Dir[SPAMIN+"/new/*"].each do |filename| puts "learning #{filename}" if $verbose > 0 if system("sudo -H -u amavis sa-learn --spam < #{filename} > /dev/null") - puts "moving #{filename}" if $verbose > 0 - move(filename, SPAMOUT) + if system("sudo -H -u amavis bogofilter --register-spam < #{filename} > /dev/null") + puts "moving #{filename}" if $verbose > 0 + move(filename, SPAMOUT) + else + STDERR.puts "Learning of #{filename} failed (bogofilter)." + end else - STDERR.puts "Learning of #{filename} failed." + STDERR.puts "Learning of #{filename} failed (SA)." end end Dir[HAMIN+"/new/*"].each do |filename| puts "learning #{filename}" if $verbose > 0 if system("sudo -H -u amavis sa-learn --ham < #{filename} > /dev/null") - puts "moving #{filename}" if $verbose > 0 - move(filename, HAMOUT) + if system("sudo -H -u amavis bogofilter --register-ham < #{filename} > /dev/null") + puts "moving #{filename}" if $verbose > 0 + move(filename, HAMOUT) + else + STDERR.puts "Learning of #{filename} failed (bogofilter)." + end else - STDERR.puts "Learning of #{filename} failed." + STDERR.puts "Learning of #{filename} failed (SA)." end end |