fix #8131 - chinese translations
[Pman.Core] / NotifySend.php
index 1140470..f94ff33 100644 (file)
@@ -87,7 +87,9 @@ class Pman_Core_NotifySend extends Pman
    
     function get($id,$opts=array())
     {
-
+        //if ($this->database_is_locked()) {
+        //    die("LATER - DATABASE IS LOCKED");
+       // }
         //print_r($opts);
         if (!empty($opts['DB_DataObject-debug'])) {
             DB_DataObject::debugLevel($opts['DB_DataObject-debug']);
@@ -124,12 +126,12 @@ class Pman_Core_NotifySend extends Pman
             HTML_FlexyFramework::get()->Core_Mailer['debug'] = true;
         }
         
-        $sent = (empty($w->sent) || preg_match('/^1000/', $w->sent)) ? false : true;
+        $sent = (empty($w->sent) || strtotime( $w->sent) < 100 ) ? false : true;
         
         if (!$force && (!empty($w->msgid) || $sent)) {
             $ww = clone($w);
             if (!$sent) {   // fix sent.
-                $w->sent = $w->sent == '0000-00-00 00:00:00' ? $w->sqlValue('NOW()') :$w->sent; // do not update if sent.....
+                $w->sent = strtotime( $w->sent) < 100 ? $w->sqlValue('NOW()') :$w->sent; // do not update if sent.....
                 $w->update($ww);
             }    
             $this->errorHandler("message has been sent already.\n");
@@ -242,7 +244,7 @@ class Pman_Core_NotifySend extends Pman
          
         
         if (isset($email['later'])) {
-            
+             
             $this->server->updateNotifyToNextServer($w, $email['later'],true);
              
             $this->errorHandler("Delivery postponed by email creator to {$email['later']}");
@@ -367,7 +369,8 @@ class Pman_Core_NotifySend extends Pman
             $this->errorHandler("config Mail[helo] is not set");
         }
         
-        
+        $email = DB_DataObject::factory('core_notify_sender')->filterEmail($email, $w);
+            
                         
         foreach($mxs as $mx) {
             
@@ -443,6 +446,8 @@ class Pman_Core_NotifySend extends Pman
                 
             }
         
+           
+            
             
             $res = $mailer->send($p->email, $email['headers'], $email['body']);
             if (is_object($res)) {
@@ -535,7 +540,11 @@ class Pman_Core_NotifySend extends Pman
                 $errmsg=  $res->userinfo['smtpcode'] . ':' . $res->userinfo['smtptext'];
             }
             
-            if ($res->userinfo['smtpcode'] == 550) {
+            if ( $res->userinfo['smtpcode']> 500 ) {
+                
+                DB_DataObject::factory('core_notify_sender')->checkSmtpResponse($email, $w, $errmsg);
+
+                
                 if ($this->server->checkSmtpResponse($errmsg, $core_domain)) {
                     $ev = $this->addEvent('NOTIFY', $w, 'BLACKLISTED  - ' . $errmsg);
                     $this->server->updateNotifyToNextServer($w,  $retry_when,true);