From ed841e50bbfb09ef0e0823d9aa7a59c24f1633ea Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 11 Oct 2023 12:28:10 +0800 Subject: [PATCH] Fix #7859 - blacklist detection --- DataObjects/Core_notify_blacklist.php | 2 +- DataObjects/Core_notify_server.php | 6 +++--- Notify.php | 4 +++- NotifySend.php | 13 ++++++++++--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/DataObjects/Core_notify_blacklist.php b/DataObjects/Core_notify_blacklist.php index 408f542c..9e02be17 100644 --- a/DataObjects/Core_notify_blacklist.php +++ b/DataObjects/Core_notify_blacklist.php @@ -20,7 +20,7 @@ class Pman_Core_DataObjects_Core_notify_blacklist extends DB_DataObject function messageIsBlacklisted($err) { $match = array( - '5.7.0 DT:SPM'. // 163.com + '5.7.0 DT:SPM', // 163.com 'on our block list ', // live.com 'spameatingmonkey.net', // spameatingmonkey.net (users) 'sender is listed on the block', // korian? diff --git a/DataObjects/Core_notify_server.php b/DataObjects/Core_notify_server.php index 7692e348..2ad73ab4 100644 --- a/DataObjects/Core_notify_server.php +++ b/DataObjects/Core_notify_server.php @@ -230,15 +230,15 @@ class Pman_Core_DataObjects_Core_notify_server extends DB_DataObject $bl->server_id = $this->id; $bl->domain_id = $core_domain->id; if ($bl->count()) { - return; + return true; } // is it a blacklist message if (!$bl->messageIsBlacklisted($errmsg)) { - return; + return false; } $bl->added_dt = $bl->sqlValue("NOW()"); $bl->insert(); - + return true; } diff --git a/Notify.php b/Notify.php index 2e5dcebd..5a33985f 100644 --- a/Notify.php +++ b/Notify.php @@ -295,7 +295,9 @@ class Pman_Core_Notify extends Pman if ($black !== false) { if (false === $this->server->updateNotifyToNextServer($p)) { - $p->updateState("????"); + $ev = $this->addEvent('NOTIFY', $p, 'BLACKLISTED FROM our DB'); + $this->server->updateNotifyToNextServer($w, strtotime('NOW + 5 MINUTES'),true); + // $this->errorHandler( $ev->remarks); } continue; diff --git a/NotifySend.php b/NotifySend.php index 8e4c0c60..91bdc7ed 100644 --- a/NotifySend.php +++ b/NotifySend.php @@ -520,12 +520,19 @@ class Pman_Core_NotifySend extends Pman $errmsg= $res->userinfo['smtpcode'] . ':' . $res->userinfo['smtptext']; } + if ($res->userinfo['smtpcode'] == 550) { + if ($this->server->checkSmtpResponse($errmsg, $core_domain)) { + $ev = $this->addEvent('NOTIFY', $w, 'BLACKLISTED - ' . $errmsg); + $this->server->updateNotifyToNextServer($w, strtotime('NOW + ' . $retry . ' MINUTES'),true); + $this->errorHandler( $ev->remarks); + } + } + + $ev = $this->addEvent('NOTIFYFAIL', $w, ($fail ? "FAILED - " : "RETRY TIME EXCEEDED - ") . $errmsg); $w->flagDone($ev, ''); - if ($res->userinfo['smtpcode'] == 550) { - $this->server->checkSmtpResponse($errmsg, $core_domain); - } + $this->errorHandler( $ev->remarks); -- 2.39.2