DataObjects/Core_notify.php
[Pman.Core] / Mailer.php
index ecfcab4..ff25d5e 100644 (file)
@@ -105,7 +105,7 @@ class Pman_Core_Mailer {
         if (!empty($fopts['DB_DataObject_translator'])) {
             $tmp_opts['DB_DataObject_translator'] = $fopts['DB_DataObject_translator'];
         }
-         if (!empty($fopts['locale'])) {
+        if (!empty($fopts['locale'])) {
             $tmp_opts['locale'] = $fopts['locale'];
         }
         
@@ -133,7 +133,7 @@ class Pman_Core_Mailer {
         $tmp_opts['nonHTML'] = true;
         
         
-        
+        //print_R($tmp_opts);
         // $tmp_opts['force'] = true;
         $template = new HTML_Template_Flexy(  $tmp_opts );
         
@@ -159,24 +159,27 @@ class Pman_Core_Mailer {
             //exit;
         } 
         
-        
+        require_once 'Mail/mime.php';
+        $mime = new Mail_mime(array(
+            'eol' => "\n",
+            //'html_encoding' => 'base64',
+            'html_charset' => 'utf-8',
+            'text_charset' => 'utf-8',
+            'head_charset' => 'utf-8',
+        ));
+        // clean up the headers...
         
         
         $parts[1]['Message-Id'] = '<' .   $content->msgid   .
                                      '@' . $content->HTTP_HOST .'>';
         
-        
-        
-        
+          
         if ($htmlbody !== false) {
-            require_once 'Mail/mime.php';
-            $mime = new Mail_mime(array('eol' => "\n",
-//                                    'html_encoding' => 'base64',
-                                    'html_charset' => 'utf-8',
-                                    'text_charset' => 'utf-8',
-                                    'head_charset' => 'utf-8'
-                ));
+            // got a html headers...
             
+            if (isset($parts[1]['Content-Type'])) {
+                unset($parts[1]['Content-Type']);
+            }
             $mime->setTXTBody($parts[2]);
             $mime->setHTMLBody($htmlbody);
 //            var_dump($mime);exit;
@@ -287,10 +290,10 @@ class Pman_Core_Mailer {
             $ext = $m->toExt($mt); 
             
             return array(
-                    'mimetype' => $mt,
-                   'ext' => $ext,
-                   'contentid' => md5($file),
-                   'file' => $file
+                'mimetype'  => $mt,
+                'ext'       =>   $ext,
+                'contentid' => md5($file),
+                'file'      => $file
             );
             
         }