Mailer.php
[Pman.Core] / Mailer.php
index 49f17ae..b0a6593 100644 (file)
@@ -503,13 +503,14 @@ class Pman_Core_Mailer {
         @$dom->loadHTML('<?xml encoding="UTF-8">' .$html);
         
         $body = $dom->getElementsByTagName('body');
-        
-        $class = $dom->createAttribute('class');
-        $class->value = $cls;
-        if (!$body->item(0)) {
-            echo $html;
+        if ($body->count()) {
+            $body->item(0)->setAttribute('class', $cls);
+        } else {
+            $body = $dom->createElement("body");
+            $body->setAttribute('class', $cls);
+            $dom->appendChild($body);
         }
-        $body->item(0)->appendChild($class);
+        
         
         return $dom->saveHTML();
     }