use the new HermesMailer everywhere !
authorx2000habouzit <x2000habouzit>
Tue, 16 Nov 2004 20:43:06 +0000 (20:43 +0000)
committerx2000habouzit <x2000habouzit>
Tue, 16 Nov 2004 20:43:06 +0000 (20:43 +0000)
include/identification.inc.php
include/tpl.mailer.inc.php

index 9316ce9..f7ef789 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: identification.inc.php,v 1.15 2004-11-15 21:04:29 x2002marichez Exp $
+        $Id: identification.inc.php,v 1.16 2004-11-16 20:43:06 x2000habouzit Exp $
  ***************************************************************************/
 
 require_once('xorg.misc.inc.php');
@@ -192,12 +192,12 @@ if ( $homonyme ) {
     if ( $h_type != 'homonyme' and empty($expire) ) {
        $globals->db->query("UPDATE aliases SET expire=ADDDATE(NOW(),INTERVAL 1 MONTH) WHERE alias='$mailorg'");
        $globals->db->query("REPLACE INTO homonymes (homonyme_id,user_id) VALUES ($h_id,$h_id)");
-       require_once('diogenes.mailer.inc.php');
-       $mailer = new DiogenesMailer('Support Polytechnique.org <support@polytechnique.org>',
-                                    "$mailorg@polytechnique.org",
-                                    "perte de ton alias $mailorg dans un mois !",
-                                    false,
-                                    'Support Polytechnique.org <support@polytechnique.org>');
+       require_once('diogenes.hermes.inc.php');
+       $mailer = new HermesMailer();
+       $mailer->setFrom('Support Polytechnique.org <support@polytechnique.org>');
+       $mailer->addTo("$mailorg@polytechnique.org");
+       $mailer->setSubject("perte de ton alias $mailorg dans un mois !");
+       $mailer->addCc('Support Polytechnique.org <support@polytechnique.org>');
        $msg =
            "Un homonyme s'est inscrit, nous ne pouvons donc garder ton alias '$mailorg'.\n\n".
            "Tu gardes tout de même l'usage de cet alias pour 1 mois encore à compter de ce jour.\n\n".
@@ -208,7 +208,7 @@ if ( $homonyme ) {
            "-- \n".
            "Polytechnique.org\n".
            "\"Le portail des élèves & anciens élèves de l'X\"";
-       $mailer->SetBody(wordwrap($msg,72));
+       $mailer->SetTxtBody(wordwrap($msg,72));
        $mailer->send();
     }
     unset($mailorg);
index 19dc6f4..83168f1 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: tpl.mailer.inc.php,v 1.3 2004-08-31 11:16:48 x2000habouzit Exp $
+        $Id: tpl.mailer.inc.php,v 1.4 2004-11-16 20:45:09 x2000habouzit Exp $
  ***************************************************************************/
 
-require_once("diogenes.mailer.inc.php");
+require_once("diogenes.hermes.inc.php");
 require_once("Smarty.class.php");
 
 /** Classe de mail avec corps en templates.
@@ -68,10 +68,13 @@ class TplMailer extends Smarty {
         // do not try to optimize, in the templates, some function can modify our object, then we
         // have to fetch in the first time, and only then send the mail.
         $body = $this->fetch($this->mail_dir."/".$this->_tpl);
-        $mailer = new DiogenesMailer($this->_from, implode(',',$this->_to),
-                                     $this->_subject, false,
-                                     implode(',',$this->_cc), implode(',',$this->_bcc));
-        $mailer->setBody($body);
+        $mailer = new HermesMailer()
+       $mailer->setFrom($this->_from);
+       $mailer->addTo(implode(',',$this->_to));
+       $mailer->setSubject($this->_subject);
+       if (!empty($this->_cc)) $mailer->addCc(implode(',',$this->_cc));
+       if (!empty($this->_cc)) $mailer->addBcc(implode(',',$this->_bcc));
+        $mailer->setTxtBody($body);
         $mailer->send();
     }
 }