Remove rejected mail from top senders statistics. Thanks to Michal Paulus for the report.

This commit is contained in:
Darold Gilles 2015-02-18 14:49:30 +01:00
parent 9cd91eecf0
commit e0c05f0438
2 changed files with 4 additions and 2 deletions

View file

@ -1165,7 +1165,7 @@ sub show_stats
} elsif ($type eq 'topsender') {
# Get sender statistics
&get_sender_stat($hostname,$year,$m,$d,$mon,$mday,$hour);
&get_recipient_stat($hostname,$year,$m,$d,$mon,$mday,$hour) if ($DOMAIN);
&get_recipient_stat($hostname,$year,$m,$d,$mon,$mday,$hour);
} elsif ($type eq 'toprecipient') {
# Get recipient statistics
&get_sender_stat($hostname,$year,$m,$d,$mon,$mday,$hour) if ($DOMAIN);
@ -3032,6 +3032,8 @@ sub compute_top_sender
{
foreach my $id (keys %STATS) {
next if ($DOMAIN && ($STATS{$id}{sender} !~ /$DOMAIN/) && !grep(/$DOMAIN/, @{$STATS{$id}{rcpt}}));
# Only compute top sender on sent messages
next if (!grep(/Sent/, @{$STATS{$id}{status}}));
$topsender{email}{$STATS{$id}{sender}}++;
if ($STATS{$id}{sender} =~ /\@(.*)/) {
$topsender{domain}{$1}++;

View file

@ -654,7 +654,7 @@ sub compute_top_stats
push(@{$topmaxrcpt{$STATS->{$id}{nrcpt}}{sender}}, $STATS->{$id}{sender});
push(@{$topmaxrcpt{$STATS->{$id}{nrcpt}}{sa_id}}, $id);
}
if ($STATS->{$id}{sender}) {
if ($STATS->{$id}{sender} && grep(/Sent/, @{$STATS->{$id}{status}})) {
my $sender = $STATS->{$id}{sender};
$topsender{email}{$sender}++;
my $dom = $sender || '';