DataObjects/Core_email.php
[Pman.Core] / DataObjects / Core_email.php
index 170c2a1..fb6dd78 100644 (file)
@@ -535,8 +535,20 @@ Content-Transfer-Encoding: 7bit
             mkdir(dirname($cachePath), 0700, true);
         }
         
-        file_put_contents($cachePath, $this->bodytext);
+        if (empty($this->use_file)) {
+            file_put_contents($cachePath, $this->bodytext);
+            return;
+        }
+        // use-file -- uses the original template...
+        $mailtext = file_get_contents($this->use_file);        
+         
+        require_once 'Mail/mimeDecode.php';
+        require_once 'Mail/RFC822.php';
         
+        $decoder = new Mail_mimeDecode($mailtext);
+        $parts = $decoder->getSendArray();
+        file_put_contents($parts[2], $this->bodytext);
+         
     }
     
     function cachedImages()
@@ -584,6 +596,17 @@ Content-Transfer-Encoding: 7bit
             return false;
         }
         
+        if (!empty($this->use_file)) {
+            $ctime = filemtime($cachePath);
+            $mtime = filemtime($this->use_file);
+            if($ctime >= $mtime){
+                return true;
+            }
+            return false;
+            
+        }
+        
+        
         
         $ctime = filemtime($cachePath);
         $mtime = array();