Fixed the descriptions of logged events as shown in the Webmin Actions Log module.
---- Changes since 1.510 ----
Added support for CIDR maps and multiple SMTP client restriction maps.
+Added spam checking to the autoreply script, if spamassassin is installed.
---- Changes since 1.490 ----
Autoreply messages starting with <html> or <body> will now be sent using the tex
t/html MIME type.
+---- Changes since 1.510 ----
+Added spam checking to the autoreply script, if spamassassin is installed.
Autoreply messages starting with <html> or <body> will now be sent using the text/html MIME type.
---- Changes since 1.510 ----
Added validation when manually editing the aliases and other map files.
+Added spam checking to the autoreply script, if spamassassin is installed.
# read headers and body
$lnum = 0;
while(<STDIN>) {
+ $headers .= $_;
s/\r|\n//g;
if (/^From\s+(\S+)/ && $lnum == 0) {
# Magic From line
exit 0;
}
+# if spamassassin is installed, feed the email to it
+$spam = &has_command("spamassassin");
+if ($spam) {
+ $temp = "/tmp/autoreply.spam.$$";
+ unlink($temp);
+ open(SPAM, "| $spam >$temp 2>/dev/null");
+ print SPAM $headers;
+ print SPAM $body;
+ close(SPAM);
+ $isspam = undef;
+ open(SPAMOUT, $temp);
+ while(<SPAMOUT>) {
+ if (/^X-Spam-Status:\s+(\S+)/i) {
+ $isspam = lc($1) eq 'yes' ? 1 : 0;
+ last;
+ }
+ last if (!/\S/);
+ }
+ close(SPAMOUT);
+ unlink($temp);
+ if ($isspam) {
+ print STDERR "Not autoreplying to spam\n";
+ exit 0;
+ }
+ }
+
# work out the correct to address
@to = ( &split_addresses($header{'to'}),
&split_addresses($header{'cc'}),
return $t;
}
+sub has_command
+{
+local ($cmd) = @_;
+if ($cmd =~ /^\//) {
+ return -x $cmd ? $cmd : undef;
+ }
+else {
+ foreach my $d (split(":", $ENV{'PATH'}), "/usr/bin", "/usr/local/bin") {
+ return "$d/$cmd" if (-x "$d/$cmd");
+ }
+ return undef;
+ }
+}