DataObjects/I18n.php
[Pman.Core] / DataObjects / Core_email.php
index a034536..cf4cbdb 100644 (file)
@@ -273,12 +273,16 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
            $contents['subject'] = $this->subject; 
         }
         
+        if(!empty($contents['rcpts']) && is_array($contents['rcpts'])){
+            $contents['rcpts'] = implode(',', $contents['rcpts']);
+        }
+        
         $ui = posix_getpwuid(posix_geteuid());
         
         $cachePath = session_save_path() . '/email-cache-' . $ui['name'] . '/mail/' . $this->tableName() . '-' . $this->id . '.txt';
         
-        if(!$this->isGenerated($cachePath)){
-            $this->cachedMailWithOutImages($force, false);
+        if($force || !$this->isGenerated($cachePath)){
+            $this->cachedMailWithOutImages($force, empty($contents['replace_links']) ? false : $contents['replace_links']);
         }
          
         require_once 'Pman/Core/Mailer.php';
@@ -311,7 +315,6 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
     function cachedMailWithOutImages($force = false, $replace_links = true)
     {  
         
-        
         $ui = posix_getpwuid(posix_geteuid());
         
         $cachePath = session_save_path() . '/email-cache-' . $ui['name'] . '/mail/' . $this->tableName() . '-' . $this->id . '.txt';
@@ -332,9 +335,10 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
 
         fwrite($fh, implode("\n", array(
             "From: {if:t.messageFrom}{t.messageFrom:h}{else:}{t.messageFrom():h}{end:}",
-            "To: {if:t.person}{t.person.getEmailFrom():h}{else:}{foreach:rcpts,v}{v:h},{end:}{end:}",
+            "To: {if:t.person}{t.person.getEmailFrom():h}{else:}{rcpts:h}{end:}",
             "Subject: {t.subject} ",
-            "X-Message-ID: {t.id} "
+            "X-Message-ID: {t.id} ",
+            "{if:t.replyTo}Reply-To: {t.replyTo:h}{end:}"
         ))."\n");