DataObjects/Core_notify.php
[Pman.Core] / NotifySend.php
index 06bc890..0fba6f9 100644 (file)
@@ -98,7 +98,8 @@ class Pman_Core_NotifySend extends Pman
             print_r($w);
         }
         
-        $sent = preg_match('/^0000/', $w->sent) ? false : true;
+        $sent = (empty($w->sent) || preg_match('/^0000/', $w->sent)) ? false : true;
+        
         if (!$force && (!empty($w->msgid) || $sent)) {
             $ww = clone($w);
             if (!$sent) { 
@@ -108,7 +109,6 @@ class Pman_Core_NotifySend extends Pman
             die("message has been sent already.\n");
         }
         
-        
         $o = $w->object();
         
         if ($o === false)  {
@@ -174,7 +174,6 @@ class Pman_Core_NotifySend extends Pman
         // this may modify $p->email. (it will not update it though)
         $email =  $this->makeEmail($o, $p, $last, $w, $force);
         
-        
         if ($email === true)  {
             
             $ev = $this->addEvent('NOTIFY', $w,
@@ -234,8 +233,8 @@ class Pman_Core_NotifySend extends Pman
          if (!empty($opts['send-to'])) {
             $p->email = $opts['send-to'];
         }
-        
-         
+        // since some of them have spaces?!?!
+        $p->email = trim($p->email);
         
         
         //print_r($p);
@@ -259,7 +258,6 @@ class Pman_Core_NotifySend extends Pman
         $mxs = $this->mxs($dom);
         $ww = clone($w);
 
-        
         if ($mxs === false) {
             $ev = $this->addEvent('NOTIFY', $w, "BAD ADDRESS - ". $p->email );
             $w->sent = date('Y-m-d H:i:s');