I use this rule of custom amavisd not lose message

This :
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) = 'fake...@fakessh.eu';
 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


This is weird: I get duplicate messages, because I use the same address as 
that of the rule

This is curious. is my perl betrayed me or something obvious escapes me


thanks for all your feedback

SL

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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/ 

Reply via email to