Fix #7859 - blacklist detection
authorAlan <alan@roojs.com>
Wed, 11 Oct 2023 04:28:10 +0000 (12:28 +0800)
committerAlan <alan@roojs.com>
Wed, 11 Oct 2023 04:28:10 +0000 (12:28 +0800)
DataObjects/Core_notify_blacklist.php
DataObjects/Core_notify_server.php
Notify.php
NotifySend.php

index 408f542..9e02be1 100644 (file)
@@ -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?
index 7692e34..2ad73ab 100644 (file)
@@ -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;
         
     }
     
index 2e5dceb..5a33985 100644 (file)
@@ -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;
index 8e4c0c6..91bdc7e 100644 (file)
@@ -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);