Question about quarantaine
Richard Smits
R.Smits at tudelft.nl
Wed Nov 30 13:29:35 CET 2016
Hello,
I have a question about a piece of quarantaine code in an Amavis config
file. Please see below :
----------------------------------------------------------------
package Amavis::Custom;
use strict;
BEGIN {
import Amavis::Conf qw(:platform :confvars c cr ca);
}
# invoked at child process creation time;
# return an object, or just undef when custom checks are not needed
sub new {
my($class,$conn,$msginfo) = @_;
my($self) = bless {}, $class;
my($xspam) = $msginfo->get_header_field_body('X-Spam-Flag',0);
my($cl_ip) = $msginfo->client_addr;
my(@myisp) = qw( x.x.x.x/27 );
# Check if our isp is the mta
if ($cl_ip ne '' && Amavis::Lookup::IP::lookup_ip_acl($cl_ip,\@myisp)) {
if ($xspam =~ /^[ \t]YES/) {
$msginfo->add_contents_category(CC_SPAM,0);
for my $r (@{$msginfo->per_recip_data}) {
$r->add_contents_category(CC_SPAM,0);
$r->bypass_spam_checks(1);
# QUARANTINE CODE HERE ?????
}
}
# Our isp mta but no X-Spam-Flag
for my $r (@{$msginfo->per_recip_data}) {
$r->bypass_spam_checks(1);
}
}
$self; # returning an object activates further callbacks,
# returning undef disables them
}
1; # insure a defined return
-----------------------------------------
The reason i have this code is that we want to skip spamscanning by
spamassassin if the mail comes from : x.x.x.x and/or has come from a
trusted MTA, then don't do any spamscanning.
But we want to quarantine those messages as well. So my question is,
what is the right code for this ?
I am looking into the Amavis perl module but is very large.
Greetings, Richard.
More information about the amavis-users
mailing list