From: Anthony PERARD Date: Fri, 1 Apr 2016 11:29:19 +0000 (+0100) Subject: control.pl: Do not sent email to the Control address X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=HEAD;p=people%2Faperard%2Femesinae.git control.pl: Do not sent email to the Control address Some spam may send email with the control address in both from: and to: which result in a loop of reply to the fail command of the email. --- diff --git a/scripts/control.pl b/scripts/control.pl index 31bfe07..2e6a09f 100755 --- a/scripts/control.pl +++ b/scripts/control.pl @@ -87,12 +87,15 @@ sub genreply ($$@) { $references .= " $message_id"; } + my @request_from_addr = Mail::Field::AddrList->extract( 'from', $head, 0 )->addresses() + if $request_from; # Send reply to: # - Requester (optionally) # - The list (only if successfully processed at least one command) # - Dist list (optionally) + # and do not send reply to ourself. push @to_field, $request_from - if $c{ControlReplyToRequestor} and $request_from; + if $c{ControlReplyToRequestor} and $request_from and $request_from_addr[0] ne $c{ControlAddressFull}; push @to_field, $c{ListAddress} if $c{ControlReplyToList} and $nrvalid > 0; push @bcc_field, $c{ControlDistAddress} if $c{ControlDistAddress};