mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Do spam check after all other checks, as it is expensive http://virtualmin.com/node/32098
This commit is contained in:
@@ -77,32 +77,6 @@ if ($header{'from'} =~ /postmaster|mailer-daemon/i ||
|
||||
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+Yes/i) {
|
||||
$isspam = 1;
|
||||
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'}),
|
||||
@@ -213,6 +187,32 @@ foreach $re (@no_regexp) {
|
||||
}
|
||||
}
|
||||
|
||||
# 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+Yes/i) {
|
||||
$isspam = 1;
|
||||
last;
|
||||
}
|
||||
last if (!/\S/);
|
||||
}
|
||||
close(SPAMOUT);
|
||||
unlink($temp);
|
||||
if ($isspam) {
|
||||
print STDERR "Not autoreplying to spam\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
# Read attached files
|
||||
foreach $f (@files) {
|
||||
local $/ = undef;
|
||||
|
||||
Reference in New Issue
Block a user