Mailer.php
[Pman.Core] / Mailer.php
index be641ce..334baa3 100644 (file)
@@ -171,7 +171,7 @@ class Pman_Core_Mailer {
             // for the html body, we may want to convert the attachments to images.
 //            var_dump($htmlbody);exit;
             
-            if($content->body_cls && strlen($content->body_cls)){
+            if(!empty($content->body_cls) && strlen($content->body_cls)){
                 $htmlbody = $this->htmlbodySetClass($htmlbody, $content->body_cls);
             }
             
@@ -386,6 +386,22 @@ class Pman_Core_Mailer {
         @$dom->loadHTML('<?xml encoding="UTF-8">' .$html);
         $imgs= $dom->getElementsByTagName('img');
         
+        $test = array();
+        
+        foreach ($imgs as $i=>$img) {
+            $url  = $img->getAttribute('src');
+            if (preg_match('#^cid:#', $url)) {
+                continue;
+            }
+            $me = $img->getAttribute('mailembed');
+            if ($me == 'no') {
+                continue;
+            }
+            $test[] = $url;
+        }
+        
+        print_R($test);exit;
+        
         foreach ($imgs as $i=>$img) {
             $url  = $img->getAttribute('src');
             if (preg_match('#^cid:#', $url)) {
@@ -500,7 +516,11 @@ class Pman_Core_Mailer {
         
         $body = $dom->getElementsByTagName('body');
         
+        $class = $dom->createAttribute('class');
+        $class->value = $cls;
+        $body->item(0)->appendChild($class);
         
+        return $dom->saveHTML();
     }
     
     function fetchImage($url)