Quarantine message when special rule will be triggered

Mark Martinec Mark.Martinec+amavis at ijs.si
Wed Jan 27 20:09:39 CET 2016


Igor Sverkos wrote:
> I would like to add some new rules to my Amavis (SA).
> Because I don't know if these rules will produce false positives I want
> to test them first. Therefore I plan to add them with a score value
> of "0.001".
> 
> To be able to check if a message which hits one of these rules is a 
> false
> positive or not I also want to quarantine (create a copy) such 
> messages.
> 
> How can I do that?

In a custom hook you can obtain a list of rules that triggered
in SpamAssassin, and call quarantining when desired.

Something like (untested):

     package Amavis::Custom;
     use strict;

     sub new { my($class,$conn,$msginfo) = @_; bless {}, $class }

     sub checks {
       my($self,$conn,$msginfo) = @_;
       my $tests = $msginfo->supplementary_info('TESTS');
       if ($tests =~ /(^|,)MYRULENAME/) {
         Amavis::do_quarantine($msginfo, undef,
           ['clean-quarantine'], 'local:sample-%m');
       }
     }

     1;


Mark


More information about the amavis-users mailing list