From 3482eb02c694a0f1e9cf48e3fb479f27780aa7fb Mon Sep 17 00:00:00 2001 From: Shawn Iverson Date: Sun, 10 Jan 2021 06:09:24 -0500 Subject: [PATCH] Detect sender on first instance only (#524) --- common/usr/share/MailScanner/perl/MailScanner/MSMail.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/usr/share/MailScanner/perl/MailScanner/MSMail.pm b/common/usr/share/MailScanner/perl/MailScanner/MSMail.pm index 00fd839..161baf2 100644 --- a/common/usr/share/MailScanner/perl/MailScanner/MSMail.pm +++ b/common/usr/share/MailScanner/perl/MailScanner/MSMail.pm @@ -897,6 +897,7 @@ sub new { my($line); my @recipient; my $recipientfound = 0; + my $senderfound = 0; my $permfail = 0; my($sender); my $opts = ''; @@ -948,6 +949,7 @@ sub new { next; } $recipientfound = 0; + $senderfound = 0; # Read in pre-data header my $msgstart = 0; while(!eof($queuehandle)) { @@ -960,9 +962,10 @@ sub new { MailScanner::Log::DebugLog("MSMail: KickMessage: recipient = $line"); $msgstart = tell $queuehandle; next; - } elsif ($line =~ /^S/) { + } elsif ($line =~ /^S/ && $senderfound == 0) { $line =~ s/^S//; $sender = $line; + $senderfound = 1; MailScanner::Log::DebugLog("MSMail: KickMessage: sender = $sender"); $msgstart = tell $queuehandle; } elsif ($line =~ /^E