From a6eece7e2f2b624fd8d4bbe58ff239521e26a18e Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Tue, 16 Nov 2004 19:45:59 +0000 Subject: [PATCH] use a real mailer class HermesMailer, the new toy from diogenes. --- include/auto.prepend.inc.php | 4 +++- include/newsletter.inc.php | 27 +++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/include/auto.prepend.inc.php b/include/auto.prepend.inc.php index a274c79..1b4d7f7 100644 --- a/include/auto.prepend.inc.php +++ b/include/auto.prepend.inc.php @@ -18,9 +18,11 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: auto.prepend.inc.php,v 1.28 2004-11-13 14:16:27 x2000habouzit Exp $ + $Id: auto.prepend.inc.php,v 1.29 2004-11-16 19:45:59 x2000habouzit Exp $ ***************************************************************************/ +ini_set('include_path',"/home/x2000habouzit/dev/diogenes/lib/:/usr/share/php:".ini_get('include_path')); + function microtime_float() { list($usec, $sec) = explode(" ", microtime()); diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index 48bd2e4..950c09e 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: newsletter.inc.php,v 1.31 2004-11-04 07:19:37 x2000habouzit Exp $ + $Id: newsletter.inc.php,v 1.32 2004-11-16 19:45:59 x2000habouzit Exp $ ***************************************************************************/ define('FEMME', 1); @@ -84,9 +84,8 @@ class NewsLetter { WHERE id='{$this->_id}'"); } - function title($mail_enc=false) { - $title = stripslashes($this->_title); - return $mail_enc ? "=?ISO-8859-1?Q?".quoted_printable_encode(str_replace(' ','_',$title),200)."?=" : $title;; + function title() { + return stripslashes($this->_title); } function head() { return stripslashes($this->_head); } @@ -256,21 +255,17 @@ EOF; } function sendTo($prenom,$nom,$forlife,$sex,$html) { - require_once('diogenes.mailer.inc.php'); - $fullname = "=?ISO-8859-1?Q?".quoted_printable_encode(str_replace(' ','_',"$prenom $nom"),200)."?="; - $mailer = new DiogenesMailer("Lettre Mensuelle Polytechnique.org ", - "$fullname <$forlife@polytechnique.org>", - $this->title(true), - $html); - $mailer->addHeader("Reply-To: info+nlp@polytechnique.org"); + require_once('diogenes.hermes.inc.php'); + $mailer = new HermesMailer(); + $mailer->setFrom("\"Lettre Mensuelle Polytechnique.org\" "); + $mailer->setSubject($this->title()); + $mailer->addTo("$prenom $nom <$forlife@polytechnique.org>"); + $mailer->addHeader('Reply-To','info+nlp@polytechnique.org'); + $mailer->setTxtBody($this->toText($prenom,$nom,$sex)); if($html) { - $mailer->addPart('text/plain; charset=iso-8859-1', 'iso-8859-1', $this->toText($prenom,$nom,$sex)); - $mailer->addPart('text/html; charset=iso-8859-1', 'iso-8859-1', $this->toHtml($prenom,$nom,$sex,true)); - } else { - $mailer->setBody($this->toText($prenom,$nom,$sex)); + $mailer->setHTMLBody($this->toHtml($prenom,$nom,$sex,true)); } $mailer->send(); - } } -- 2.1.4