initial commit of file from CVS for smeserver-learn on Sat Sep 7 20:30:28 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:30:28 +10:00
parent 931fa41b7f
commit 6a26018715
41 changed files with 586 additions and 2 deletions

36
root/usr/bin/LearnInWL.pl Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/perl
#############################################################################
#
# This script has been developed
# by Emmanuel Jooris at http://sme.firewall-services.com
#
# Revision History:
#
# June 06, 2008: : Initial dev version
#############################################################################
use Email::Simple;
use esmith::ConfigDB;
use warnings;
$/=undef;
open(MAIL,$ARGV[0]);
$file = <MAIL>;
close(MAIL);
$/="\n";
my $email = Email::Simple->new($file);
my $from_header = $email->header("From");
my $sadb = esmith::ConfigDB->open("spamassassin")
or die "Could not open SpamAssasinDB ( reason : )".esmith::DB->error." )\n";
if ($from_header =~ m/<.*?>/) {
$from_mail = $&;
$from_mail =~ s/<//;
$from_mail =~ s/>//;
}
elsif ($from_header =~ m/@/) {
$from_mail = $&;
}
$from_mail =~ tr/[A-Z]/[a-z]/;
$sadb->set_prop("wbl.global",$from_mail,"White");