initial commit of file from CVS for smeserver-learn on Sat Sep 7 20:30:28 AEST 2024
This commit is contained in:
36
root/usr/bin/LearnInWL.pl
Executable file
36
root/usr/bin/LearnInWL.pl
Executable 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");
|
||||
Reference in New Issue
Block a user