DataObjects/ProjectDirectory.php
[Pman.Core] / Mailer.php
index a6dc130..32c934c 100644 (file)
@@ -3,6 +3,13 @@
 /**
  *
  *  code that used to be in Pman (sendTemplate / emailTemplate)
+ * 
+ *  template is in template directory subfolder 'mail'
+ *   
+ *  eg. use 'welcome' as template -> this will use templates/mail/welcome.txt
+ *  if you also have templates/mail/welcome.body.html - then that will be used as 
+ *     the html body
+ * 
  *
  *  usage:
  *
        page => 
        contents
        template
-       replaceImages => true|false
+       replaceImages => true|false,
+       rcpts => array()   // override recipients..
     ]
  *
+ *  recipents is gathered from the resulting template
+ *   -- eg.
+ *    To: <a>,<b>,<c>
+ * 
+ * 
+ *  if the file     '
+ * 
+ * 
  *  $x->asData(); // returns data needed for notify?? - notify should really
  *                  // just use this to pass around later..
  *
@@ -29,7 +45,7 @@ class Pman_Core_Mailer {
     var $contents       = false; /* object or array */
     var $template       = false; /* string */
     var $replaceImages  = false; /* boolean */
-    
+    var $rcpts   = false;
     
     var $images         = array(); // generated list of cid images for sending
     
@@ -175,12 +191,13 @@ class Pman_Core_Mailer {
         ///$recipents = array($this->email);
         $mailOptions = PEAR::getStaticProperty('Mail','options');
         $mail = Mail::factory("SMTP",$mailOptions);
-        $headers['Date'] = date('r');
+        $headers['Date'] = date('r'); 
         if (PEAR::isError($mail)) {
             return $mail;
         } 
+        $rcpts = $this->rcpts == false ? $email['recipents'] : $this->rcpts;
         $oe = error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
-        $ret = $mail->send($email['recipents'],$email['headers'],$email['body']);
+        $ret = $mail->send($rcpts,$email['headers'],$email['body']);
         error_reporting($oe);
        
         return $ret;