Put mail smarty cache in a separated directory
[platal.git] / classes / plmailer.php
index 58e6997..46a854e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -21,8 +21,6 @@
 
 require_once('smarty/libs/Smarty.class.php');
 
-// {{{ class PlMail
-
 /** Classe de mail avec corps en templates.
  */
 class PlMail extends Smarty
@@ -39,8 +37,9 @@ class PlMail extends Smarty
         $this->compile_check = true;
 
         $this->template_dir  = $globals->spoolroot . "/templates/";
-        $this->compile_dir   = $globals->spoolroot . "/spool/templates_c/";
+        $this->compile_dir   = $globals->spoolroot . "/spool/templates_c/mails/";
         $this->config_dir    = $globals->spoolroot . "/configs/";
+        
 
         $this->register_outputfilter(Array($this, 'mail_format'));
         $this->register_function('from',    Array($this, 'setFrom'));
@@ -239,6 +238,7 @@ class PlMailer extends Mail_Mime {
     
     private function processPage($with_html = true)
     {
+        $level = error_reporting(0);
         if (!is_null($this->page)) {
             $this->setTxtBody($this->page->run(false));
             if ($with_html) {
@@ -248,13 +248,15 @@ class PlMailer extends Mail_Mime {
                 }
             }
         }
+        error_reporting($level);
     }
 
     public function send($with_html = true)
     {
         $this->processPage($with_html);
         if (S::v('forlife')) {
-            $this->addHeader('X-Org-Mail', S::v('forlife') . '@polytechnique.org');
+            global $globals;
+            $this->addHeader('X-Org-Mail', S::v('forlife') . '@' . $globals->mail->domain);
         }
         $addrs = Array();
         foreach(Array('To', 'Cc', 'Bcc') as $hdr) {