DataObjects/core.sql
[Pman.Core] / Mailer.php
index e635db9..8fc6021 100644 (file)
@@ -209,28 +209,28 @@ class Pman_Core_Mailer {
                 );
             }
             $isMine = true;
-            
-        
         }
         
         if($this->attachments){
             //if got a attachments
             
-            if (isset($parts[1]['Content-Type'])) {
-                
-                unset($parts[1]['Content-Type']);
+            $header = $mime->headers($parts[1]);
+            
+            if(preg_match('/text\/html/', $header['Content-Type'])){
+                $mime->setHTMLBody($parts[2]);
+            }else{
+                $mime->setTXTBody($parts[2]);
             }
-            $mime->setTXTBody($parts[2]);
+            
             foreach($this->attachments as $attch){
                 $mime->addAttachment(
                         $attch['file'],
                         $attch['mimetype'],
-                        $attch['name']
+                        $attch['name'],
+                        false
                 );
-                
             }
             
-            print_r($mine);
             $isMine = true;
         }
         
@@ -238,9 +238,10 @@ class Pman_Core_Mailer {
             $parts[2] = $mime->get();
             $parts[1] = $mime->headers($parts[1]);
         }
-        echo '<PRE>';
-        print_r('parts');
-        print_r($parts);exit;
+//        echo '<PRE>';
+//        print_r('parts');
+//        print_r($parts[2]);
+//        exit;
        // list($recipents,$headers,$body) = $parts;
         return array(
             'recipents' => $parts[0],