DataObjects/I18n.php
[Pman.Core] / Mailer.php
index 1a66928..8ded27f 100644 (file)
@@ -16,7 +16,7 @@
  *
  *  $x= new Pman_Core_Mailer($opts)
  *
- *  $opts[
+ *  $x= Pman_Core_Mailer(array(
        page => 
        contents
        template
@@ -32,7 +32,7 @@
         ), 
         ......
   
-    ]
+    )
  *
  *  recipents is gathered from the resulting template
  *   -- eg.
@@ -42,7 +42,7 @@
  *  if the file     '
  * 
  * 
- *  $x->asData(); // returns data needed for notify?? - notify should really
+ *  $x->toData(); // returns data needed for notify?? - notify should really
  *                  // just use this to pass around later..
  *
  *  $x->send();
@@ -140,7 +140,9 @@ class Pman_Core_Mailer {
             
             // for the html body, we may want to convert the attachments to images.
 //            var_dump($htmlbody);exit;
-            $htmlbody = $this->htmlbodytoCID($htmlbody);
+            if ($this->replaceImages) {
+                $htmlbody = $this->htmlbodytoCID($htmlbody);    
+            }
             
               
         }
@@ -279,7 +281,7 @@ class Pman_Core_Mailer {
         $mail = Mail::factory("SMTP",$mailOptions);
         $email['headers']['Date'] = date('r'); 
         if (PEAR::isError($mail)) {
-             $pg->addEvent("COREMAILER-FAIL",  false, "mail factory failed"); 
+            $pg->addEvent("COREMAILER-FAIL",  false, "mail factory failed"); 
       
             
             return $mail;
@@ -316,7 +318,6 @@ class Pman_Core_Mailer {
                 continue;
             }
             $conv = $this->fetchImage($url);
-            print_r($conv);exit;
             $this->images[$conv['contentid']] = $conv;
             
             $img->setAttribute('src', 'cid:' . $conv['contentid']);
@@ -378,7 +379,7 @@ class Pman_Core_Mailer {
         
         $cache = ini_get('session.save_path')."/Pman_Core_Mailer-{$user}/" . md5($url);
         if (file_exists($cache) and filemtime($cache) > strtotime('NOW - 1 WEEK')) {
-            $ret =  json_decode($cache);
+            $ret =  json_decode(file_get_contents($cache), true);
             $ret['file'] = $cache . '.data';
             return $ret;
         }