When I say the messages still in the LearnAsSpam folder that is when I ran it at the command prompt. It shows that it sees the spam, but that is it.
[root@host2 ~]# perl /usr/bin/LearnAsSpam.pl
Checking for user (xxx): Doyle Glaze
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167804923.P17460Q0M525768.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806820.P21206Q0M68116.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q0M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q1M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q2M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q3M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q4M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q5M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q6M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q7M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167806878.P21318Q8M3275.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/dpg/Maildir/.LearnAsSpam/cur/1167890188.P25284Q0M475056.host2\:2,S
Result of sa-learn:
Checking for user (spam): Spam Email
Learning Spammail: /home/e-smith/files/users/spam/Maildir/.LearnAsSpam/cur/1167881462.P7084Q0M978283.host2\:2,S
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/spam/Maildir/.LearnAsSpam/cur/1167884037.14378.host2\:2,
Result of sa-learn:
Learning Spammail: /home/e-smith/files/users/spam/Maildir/.LearnAsSpam/cur/1167884260.15236.host2\:2,
Result of sa-learn:
This is what I am getting it when I run it as root....
This is the code I am running. I have made no changes to users or code:
#!/usr/bin/perl
#############################################################################
#
# This script has been developed
# by Jesper Knudsen at
http://sme.swerts-knudsen.dk#
# Revision History:
#
# January 18, 2006: Initial version
#############################################################################
#
# Each user needs ssh - chsh -s /bin/bash <user>
#
use Sys::Hostname;
use esmith::AccountsDB;
my $hostname = hostname();
my $adb = esmith::AccountsDB->open_ro()
or die "Couldnt' open AccountsDB\n";
my @users = $adb->users;
foreach my $user (@users)
{
my $firstname = $user->prop('FirstName');
my $lastname = $user->prop('LastName');
my $key = $user->key;
printf("Checking for user (%s): %s %s\n", $key,$firstname, $lastname);
$MailDir = "/home/e-smith/files/users/" . $key . "/Maildir";
opendir(LOGDIR, $MailDir);
my $dirname = sprintf "LearnAsSpam";
my @logdirs = sort grep { /$dirname/ } readdir(LOGDIR);
closedir(LOGDIR);
foreach my $logdir (@logdirs) {
my $SpamDir = $MailDir . "/" . $logdir . "/cur/";
# printf("Checking Dir: %s\n",$SpamDir);
opendir(SPAMDIR, $SpamDir);
my @spamfiles = sort grep { /$hostname/ } readdir(SPAMDIR);
closedir(SPAMDIR);
foreach $spamfile (@spamfiles) {
my $filetolearn = $Maildir . $SpamDir . $spamfile;
$filetolearn =~ s/;/\\;/g;
$filetolearn =~ s/:/\\:/g;
printf("Learning Spammail: %s\n",$filetolearn);
my $result = `su - $key -c "/usr/bin/sa-learn --spam $filetolearn"`;
printf("Result of sa-learn: %s\n",$result);
# Now delete the file after learning
my $delete = `su - $key -c "rm -f $filetolearn"`;
# printf("Result of delete: %s\n",$delete);
}
}
}
Is ther something I am missing?