diff --git a/src/app/Policy/Greylist/Request.php b/src/app/Policy/Greylist/Request.php --- a/src/app/Policy/Greylist/Request.php +++ b/src/app/Policy/Greylist/Request.php @@ -182,8 +182,7 @@ return false; } - // determine if the sender, net and recipient combination has existed before, for each recipient - // any one recipient matching should supersede the other recipients not having matched + // Retrieve the entry for the sender/recipient/net combination $connect = Connect::where( [ 'sender_local' => $this->senderLocal, @@ -192,19 +191,16 @@ 'net_id' => $this->netID, 'net_type' => $this->netType, ] - ) - ->whereDate('updated_at', '>=', $this->timestamp->copy()->subMonthsWithoutOverflow(1)) - ->orderBy('updated_at') - ->first(); + )->first(); - $deferIfPermit = true; + $defer = true; if ($connect) { $connect->connect_count += 1; // TODO: The period of time for which the greylisting persists is configurable. if ($connect->created_at < $this->timestamp->copy()->subMinutes(5)) { - $deferIfPermit = false; + $defer = false; $connect->greylisting = false; } @@ -226,7 +222,7 @@ ); } - return $deferIfPermit; + return $defer; } private function findConnectsCollection()