Le jeudi 29 avril 2010 08:45, Lampa a écrit : > Hello, > > is there some way how to setup forwarding mails marked as SPAM for > some domains to one user (spam for domains @example.com, > @example2.com, @example3.com, ... forward to s...@example.com) ? > > Thank you for advices and help. [r...@******** ~]# cat /etc/amavisd-custom-test.conf package Amavis::Custom; use strict;
BEGIN { import Amavis::Conf qw(:platform :confvars c cr ca $myhostname); import Amavis::rfc2821_2822_Tools; import Amavis::Util qw(do_log untaint); } sub new { my($class,$conn,$msginfo) = @_; my($self) = bless {}, $class; $self; } sub after_send { my($self,$conn,$msginfo) = @_; my($spam_level) = $msginfo->spam_level; do_log(1,"CUSTOM: entered after_send hook"); if ($spam_level < 100) { my($recip) = 'postmas...@*********'; do_log(1,"CUSTOM: sending a copy to %s", $recip); my($notification) = Amavis::In::Message->new; $notification->rx_time($msginfo->rx_time); # copy the reception time $notification->log_id($msginfo->log_id); # copy log id $notification->msg_size($msginfo->msg_size); $notification->delivery_method(c('notify_method')); $notification->originating(0); # disables DKIM signing $notification->sender(''); # use null or whatever sender address $notification->sender_smtp(qquote_rfc2821_local($notification->sender)); $notification->recips([$recip]); $notification->mail_text($msginfo->mail_text); # use the same contents Amavis::mail_dispatch($conn, $notification, 'Quar', 0); my($n_smtp_resp, $n_exit_code, $n_dsn_needed) = one_response_for_all($notification, 0); # check status if ($n_smtp_resp =~ /^2/ && !$n_dsn_needed) { # ok } elsif ($n_smtp_resp =~ /^4/) { die "temporarily unable to alert recipient: $n_smtp_resp"; } else { do_log(-1, "FAILED to send a copy: %s", $n_smtp_resp); } } } 1; # insure a defined return [r...@******* ~]# ------------------------------------------------------------------------------ _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/