DataObjects/Core_curr_rate.php
[Pman.Core] / Mailer.php
index de4252f..8002ef1 100644 (file)
@@ -142,6 +142,8 @@ class Pman_Core_Mailer {
             $htmltemplate->compile('mail/'. $templateFile.'.body.html');
             $htmlbody =  $htmltemplate->bufferedOutputObject($content);
             
+            $this->htmlbody = $htmlbody;
+            
             // for the html body, we may want to convert the attachments to images.
 //            var_dump($htmlbody);exit;
             if ($this->replaceImages) {
@@ -260,7 +262,8 @@ class Pman_Core_Mailer {
         return array(
             'recipents' => $parts[0],
             'headers' => $parts[1],
-            'body' => $parts[2]
+            'body' => $parts[2],
+            'mailer' => $this
         );
     }
     function send($email = false)
@@ -282,7 +285,13 @@ class Pman_Core_Mailer {
         ///$recipents = array($this->email);
         $mailOptions = PEAR::getStaticProperty('Mail','options');
         //print_R($mailOptions);exit;
-        $mail = Mail::factory("SMTP",$mailOptions);
+        
+        if ($this->mail_method == 'SMTPMX' && empty($mailOptions['mailname'])) {
+            $pg->jerr("Mail[mailname] is not set - this is required for SMTPMX");
+            
+        }
+        
+        $mail = Mail::factory($this->mail_method,$mailOptions);
         if ($this->debug) {
             $mail->debug = $this->debug;
         }
@@ -308,8 +317,10 @@ class Pman_Core_Mailer {
                 'To: ' .  ( is_array($rcpts) ? implode(', ', $rcpts) : $rcpts ) .
                 'Subject: '  . @$email['headers']['Subject']
             ); 
-        }  
-       
+        }  else {
+            $pg->addEvent("COREMAILER-FAIL",  false, $ret->toString());
+        }
+        
         return $ret;
     }