From 1e33266a2f91e1af7a5cb3e8fbbc1c49ff9341f3 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Sat, 2 Dec 2006 18:02:49 +0000 Subject: [PATCH] New PlMailer based on Hermes code: * merge XOrgMailer and Hermes * fix sendmail arguments to "-oi" * allow to choose the charset of the mail * always add the forlife of the session owner in email headers git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1227 839d8a87-29fc-0310-9880-83ba4fa771e5 --- ChangeLog | 7 +- bin/cron/cron_validations.php | 4 +- bin/cron/notifs.send.php | 4 +- bin/cron/rapports_inscription.php | 4 +- bin/emails.broken.php | 4 +- bin/newsletter.send.php | 5 +- include/emails.inc.php | 3 +- include/homonymes.inc.php | 6 +- include/marketing.inc.php | 7 +- include/newsletter.inc.php | 19 ++-- include/register.inc.php | 9 +- include/validations.inc.php | 6 +- include/validations/homonymes.inc.php | 3 +- include/xnet/mail.inc.php | 5 +- include/xorg.mailer.inc.php | 171 ----------------------------- modules/admin.php | 6 +- modules/banana.php | 3 +- modules/email.php | 8 +- modules/events.php | 3 +- modules/lists.php | 3 +- modules/marketing.php | 3 +- modules/payment.php | 15 +-- modules/platal.php | 3 +- modules/register.php | 6 +- modules/xnet.php | 3 +- modules/xnetgrp.php | 9 +- templates/mails/forums.promo.tpl | 2 + templates/mails/listes.promo.tpl | 2 + templates/marketing/mail.relance.tpl | 2 + templates/register/inscription.reussie.tpl | 2 + templates/register/inscrire.mail.tpl | 3 +- 31 files changed, 69 insertions(+), 261 deletions(-) delete mode 100644 include/xorg.mailer.inc.php diff --git a/ChangeLog b/ChangeLog index 75417f3..386aff0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,9 +3,13 @@ VERSION 0.9.13 ?? ?? 2007 New: + * Core: + - New mailer -FRU + * Events: - Tips. -FRU/Car - Signal bug send to OTRS and not trackers. -Car + - Reskin the newsletter -mYk * Payment: - Directly integrated into Xnet. -FRU @@ -863,9 +867,10 @@ ACRONYMS: * Car: Pascal Corpet (Caribou) * CAT: Florian El Ahdab (LeChat) * FAL: Raphaël Marichez (Falco) - * FRU: Florent Bruneau (fruneau) + * FRU: Florent Bruneau (Fruneau) * JS : Jean Sébastien Bedo * MC : Pierre Habouzit (MadCoder) + * mYk: Aymeric Augusting (mYk) * OG : Olivier Guillaumin * SHK: Jeremy Lainé (Sharky) * VP : Vincent Palatin diff --git a/bin/cron/cron_validations.php b/bin/cron/cron_validations.php index ae78bde..a1bc8f2 100755 --- a/bin/cron/cron_validations.php +++ b/bin/cron/cron_validations.php @@ -27,7 +27,7 @@ $M_PERIOD = "INTERVAL 3 HOUR"; // p $R_PERIOD = "INTERVAL 6 HOUR"; // période de réponse moyenne de 6h require('./connect.db.inc.php'); -require('diogenes/diogenes.hermes.inc.php'); +require('../classes/plmailer.php'); $res = XDB::query("SELECT count(stamp), sum(stamp < NOW() - $M_PERIOD), sum(stamp < NOW() - $R_PERIOD) FROM x4dat.requests"); list($nb,$nbold,$nbveryold) = $res->fetchOneRow(); @@ -36,7 +36,7 @@ if (empty($nb)) { exit; } -$mymail = new HermesMailer(); +$mymail = new PlMailer(); $mymail->setFrom('validation@polytechnique.org'); $mymail->addTo("validation@polytechnique.org"); $mymail->setSubject((empty($nbveryold)?"":"[urgent] ")."il y a $nb validations non effectuées"); diff --git a/bin/cron/notifs.send.php b/bin/cron/notifs.send.php index aa22a12..0907fec 100755 --- a/bin/cron/notifs.send.php +++ b/bin/cron/notifs.send.php @@ -21,8 +21,8 @@ ***************************************************************************/ require_once('./connect.db.inc.php'); +require_once('../../classes/plmailer.php'); require_once("../../include/notifs.inc.php"); -require_once("diogenes/diogenes.hermes.inc.php"); $all = new AllNotifs(); @@ -82,7 +82,7 @@ EOF; EOF; - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setFrom("Carnet Polytechnicien "); $mailer->addTo("\"{$u['prenom']} {$u['nom']}\" <{$u['bestalias']}@polytechnique.org>"); $mailer->setSubject("Notifications de la semaine $week"); diff --git a/bin/cron/rapports_inscription.php b/bin/cron/rapports_inscription.php index 7086ee7..2075b2b 100755 --- a/bin/cron/rapports_inscription.php +++ b/bin/cron/rapports_inscription.php @@ -45,8 +45,8 @@ $MESSAGE .= " $a utilisateurs\n $b adresses mails\n"; $MESSAGE .= "\n\n"; -require_once('diogenes/diogenes.hermes.inc.php'); -$mailer = new HermesMailer(); +require_once('../../classes/plmailer.php'); +$mailer = new PlMailer(); $mailer->setSubject("$a confirmées, $b en attente et $c sollicitées"); $mailer->setFrom('register@polytechnique.org'); $mailer->addTo('register@polytechnique.org'); diff --git a/bin/emails.broken.php b/bin/emails.broken.php index e307983..e767c4c 100755 --- a/bin/emails.broken.php +++ b/bin/emails.broken.php @@ -104,8 +104,8 @@ d'acc elle te permettra de créer un nouveau mot de passe après avoir rentré ton login ({$x['alias']}) et ta date de naissance !"; - require_once("diogenes/diogenes.hermes.inc.php"); - $mail = new HermesMailer(); + require_once('../classes/plmailer.php'); + $mail = new PlMailer(); $mail->setFrom('"Polytechnique.org" '); $mail->addTo("\"{$x['prenom']} {$x['nom']}\" <{$x['alias']}@polytechnique.org>"); $mail->setSubject("Une de tes adresse de redirection Polytechnique.org ne marche plus !!"); diff --git a/bin/newsletter.send.php b/bin/newsletter.send.php index e12c262..d1dc606 100755 --- a/bin/newsletter.send.php +++ b/bin/newsletter.send.php @@ -20,8 +20,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require('./connect.db.inc.php'); -require("newsletter.inc.php"); +require_once('./connect.db.inc.php'); +require_once('../classes/plmailer.php'); +require_once("newsletter.inc.php"); $opt = getopt('i:h'); diff --git a/include/emails.inc.php b/include/emails.inc.php index eeb33b1..a87bb7c 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -271,8 +271,7 @@ class Redirect . ". Cette adresse est surveillée avec l'état *" . $row['state'] . "* et la description :\n" . $row['description']; $message = wordwrap($message); - require_once("diogenes/diogenes.hermes.inc.php"); - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setFrom("webmaster@polytechnique.org"); $mailer->addTo("hotliners@staff.polytechnique.org"); $mailer->setSubject("ALERTE LORS DE L'AJOUT DE REDIRECTION de " diff --git a/include/homonymes.inc.php b/include/homonymes.inc.php index 6ebb4d1..6023d3b 100644 --- a/include/homonymes.inc.php +++ b/include/homonymes.inc.php @@ -29,10 +29,9 @@ function select_if_homonyme($uid) { } function send_warning_homonyme($prenom, $nom, $forlife, $loginbis) { - require_once("diogenes/diogenes.hermes.inc.php"); $cc = "support+homonyme@polytechnique.org"; $FROM = "\"Support Polytechnique.org\" <$cc>"; - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom($FROM); $mymail->setSubject("Dans 2 semaines, suppression de $loginbis@polytechnique.org"); $mymail->addTo("$prenom $nom <$forlife@polytechnique.org>"); @@ -42,10 +41,9 @@ function send_warning_homonyme($prenom, $nom, $forlife, $loginbis) { } function send_robot_homonyme($prenom, $nom, $forlife, $loginbis) { - require_once("diogenes/diogenes.hermes.inc.php"); $cc = "support+homonyme@polytechnique.org"; $FROM = "\"Support Polytechnique.org\" <$cc>"; - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom($FROM); $mymail->setSubject("Mise en place du robot $loginbis@polytechnique.org"); $mymail->addTo("$prenom $nom <$forlife@polytechnique.org>"); diff --git a/include/marketing.inc.php b/include/marketing.inc.php index db2c1bc..c4fa1e9 100644 --- a/include/marketing.inc.php +++ b/include/marketing.inc.php @@ -78,8 +78,6 @@ function mark_text_mail($uid, $email) function mark_send_mail($uid, $email, $perso, $to='', $title='', $text='') { - require_once("diogenes/diogenes.hermes.inc.php"); - $hash = rand_url_id(12); XDB::execute('UPDATE register_marketing SET nb=nb+1,hash={?},last=NOW() WHERE uid={?} AND email={?}', $hash, $uid, $email); @@ -94,7 +92,7 @@ function mark_send_mail($uid, $email, $perso, $to='', $title='', $text='') $sender = substr($from, 1, strpos($from, '"', 2)-1); $text = str_replace(array("%%hash%%", "%%sender%%"), array($hash, $sender), $text); - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setFrom($from); $mailer->addTo($to); $mailer->setSubject($title); @@ -107,7 +105,6 @@ function mark_send_mail($uid, $email, $perso, $to='', $title='', $text='') function relance($uid, $nbx = -1) { - require_once('xorg.mailer.inc.php'); global $globals; if ($nbx < 0) { @@ -131,7 +128,7 @@ function relance($uid, $nbx = -1) $pass_encrypted = hash_encrypt($pass); $fdate = strftime('%d %B %Y', strtotime($date)); - $mymail = new XOrgMailer('marketing/mail.relance.tpl'); + $mymail = new PlMailer('marketing/mail.relance.tpl'); $mymail->assign('nbdix', $nbx); $mymail->assign('fdate', $fdate); $mymail->assign('lusername', $alias); diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index d1d497b..426bc27 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -349,23 +349,22 @@ EOF; function sendTo($prenom, $nom, $login, $sex, $html) { global $globals; - require_once('diogenes/diogenes.hermes.inc.php'); - $mailer = new HermesMailer(); - $mailer->setFrom($globals->newsletter->from); - $mailer->setSubject($this->title(true)); - $mailer->addTo("\"$prenom $nom\" <$login@{$globals->mail->domain}>"); + $mailer = new PlMailer(); + $mailer->setFrom($globals->newsletter->from); + $mailer->setSubject($this->title(true)); + $mailer->addTo("\"$prenom $nom\" <$login@{$globals->mail->domain}>"); if (!empty($globals->newsletter->replyto)) { $mailer->addHeader('Reply-To',$globals->newsletter->replyto); } if (!empty($globals->newsletter->retpath)) { $mailer->addHeader('Return-Path',$globals->newsletter->retpath); } - $mailer->setTxtBody($this->toText($prenom,$nom,$sex)); - if ($html) { - $mailer->setHTMLBody($this->toHtml($prenom,$nom,$sex,true)); - } - $mailer->send(); + $mailer->setTxtBody($this->toText($prenom,$nom,$sex)); + if ($html) { + $mailer->setHTMLBody($this->toHtml($prenom,$nom,$sex,true)); + } + $mailer->send(); } // }}} diff --git a/include/register.inc.php b/include/register.inc.php index c77a997..d073be3 100644 --- a/include/register.inc.php +++ b/include/register.inc.php @@ -193,8 +193,7 @@ function create_aliases (&$sub) $res = XDB::query("SELECT alias FROM aliases WHERE id={?} AND expire IS NULL", $h_id); $als = $res->fetchColumn(); - require_once('diogenes/diogenes.hermes.inc.php'); - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setFrom('"Support Polytechnique.org" '); $mailer->addTo("$mailorg@polytechnique.org"); $mailer->setSubject("perte de ton alias $mailorg dans un mois !"); @@ -244,8 +243,7 @@ function create_aliases (&$sub) function send_alert_mail($state, $body) { - require_once("diogenes/diogenes.hermes.inc.php"); - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setFrom("webmaster@polytechnique.org"); $mailer->addTo("hotliners@staff.polytechnique.org"); $mailer->setSubject("ALERTE LORS DE L'INSCRIPTION de " @@ -276,8 +274,7 @@ function finish_ins($sub_state) VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW(), 0, {?}, {?})", $uid, $forlife, $bestalias, $mailorg2, $pass_encrypted, $email, $naissance, $hash); - require_once('xorg.mailer.inc.php'); - $mymail = new XOrgMailer('register/inscrire.mail.tpl'); + $mymail = new PlMailer('register/inscrire.mail.tpl'); $mymail->assign('mailorg', $bestalias); $mymail->assign('lemail', $email); $mymail->assign('pass', $pass); diff --git a/include/validations.inc.php b/include/validations.inc.php index bc88ddf..aeb8b4b 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -182,8 +182,7 @@ class Validate // envoi d'un mail à hotliners global $globals; - require_once('diogenes/diogenes.hermes.inc.php'); - $mailer = new HermesMailer; + $mailer = new PlMailer; $mailer->setSubject("Commentaires de validation {$this->type}"); $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}"); $mailer->addTo("hotliners@staff.polytechnique.org"); @@ -233,8 +232,7 @@ class Validate function sendmail($isok) { global $globals; - require_once('diogenes/diogenes.hermes.inc.php'); - $mailer = new HermesMailer; + $mailer = new PlMailer(); $mailer->setSubject($this->_mail_subj()); $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}"); $mailer->addTo("\"{$this->prenom} {$this->nom}\" <{$this->bestalias}@{$globals->mail->domain}>"); diff --git a/include/validations/homonymes.inc.php b/include/validations/homonymes.inc.php index 9a628da..c349d94 100644 --- a/include/validations/homonymes.inc.php +++ b/include/validations/homonymes.inc.php @@ -99,8 +99,7 @@ est ambigu pour des raisons d'homonymie et signalera ton email exact."; { if (!$isok) return false; global $globals; - require_once('diogenes/diogenes.hermes.inc.php'); - $mailer = new HermesMailer; + $mailer = new PlMailer; $cc = "support+homonyme@".$globals->mail->domain; $FROM = "\"Support Polytechnique.org\" <$cc>"; $mailer->setSubject($this->_mail_subj()); diff --git a/include/xnet/mail.inc.php b/include/xnet/mail.inc.php index 7d3a815..ac7f752 100644 --- a/include/xnet/mail.inc.php +++ b/include/xnet/mail.inc.php @@ -19,8 +19,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once 'diogenes/diogenes.hermes.inc.php'; - // {{{ get_all_redirects function get_all_redirects($membres, $mls, &$client) @@ -103,10 +101,9 @@ function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null) global $globals; $sent = array(); - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setSubject($sujet); $mailer->setFrom($from); - $mailer->addHeader('X-Xorg-Login', S::v('bestalias') . '@' . $globals->mail->domain); foreach ($tos as $user) { if ($sent[$user['email']]) continue; diff --git a/include/xorg.mailer.inc.php b/include/xorg.mailer.inc.php deleted file mode 100644 index ccc4791..0000000 --- a/include/xorg.mailer.inc.php +++ /dev/null @@ -1,171 +0,0 @@ -_tpl = $tpl; - $this->caching=false; - $this->compile_check=true; - - $this->template_dir = $globals->spoolroot . "/templates/"; - $this->compile_dir = $globals->spoolroot . "/spool/templates_c/"; - $this->config_dir = $globals->spoolroot . "/configs/"; - - $this->register_outputfilter('mail_format'); - $this->register_function('from', 'set_from'); - $this->register_function('to', 'set_to'); - $this->register_function('cc', 'set_cc'); - $this->register_function('bcc', 'set_bcc'); - $this->register_function('subject', 'set_subject'); - } - - // }}} - // {{{ function send() - - function send() - { - // 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->_tpl); - $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->_bcc)) { - $mailer->addBcc(implode(',',$this->_bcc)); - } - $mailer->setTxtBody($body); - $mailer->send(); - } - - // }}} -} - -// }}} -// {{{ function mail_format() - -/** used to remove the empty lines due to {from ...}, {to ...} ... functions */ -function mail_format($output, &$smarty) -{ - return wordwrap("\n".trim($output)."\n",75); -} - -// }}} -// {{{ function format_addr() - -function format_addr(&$params) -{ - if (isset($params['full'])) { - return $params['full']; - } elseif (empty($params['text'])) { - return $params['addr']; - } else { - return $params['text'].' <'.$params['addr'].'>'; - } -} - -// }}} -// {{{ function set_from() - -/** template function : from. - * {from full=...} for an already formatted address - * {from addr=... [text=...]} else - */ -function set_from($params, &$smarty) -{ $smarty->_from = format_addr($params); } - -// }}} -// {{{ function set_to() - -/** template function : to. - * {to full=...} for an already formatted address - * {to addr=... [text=...]} else - */ -function set_to($params, &$smarty) -{ $smarty->_to[] = format_addr($params); } - -// }}} -// {{{ function set_cc() - -/** template function : cc. - * {cc full=...} for an already formatted address - * {cc addr=... [text=...]} else - */ -function set_cc($params, &$smarty) -{ $smarty->_cc[] = format_addr($params); } - -// }}} -// {{{ function set_bcc() - -/** template function : bcc. - * {bcc full=...} for an already formatted address - * {bcc addr=... [text=...]} else - */ -function set_bcc($params, &$smarty) -{ $smarty->_bcc[] = format_addr($params); } - -// }}} -// {{{ function set_subject() - -/** template function : subject. - * {subject text=...} - */ -function set_subject($params, &$smarty) -{ - $smarty->_subject = $params['text']; -} - -// }}} - -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: -?> diff --git a/modules/admin.php b/modules/admin.php index 1d4d502..b3f459f 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -486,8 +486,7 @@ class AdminModule extends PLModule if (XDB::execute($query)) { user_reindex($mr['user_id']); - require_once("diogenes/diogenes.hermes.inc.php"); - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setFrom("webmaster@polytechnique.org"); $mailer->addTo("web@polytechnique.org"); $mailer->setSubject("INTERVENTION de ".S::v('forlife')); @@ -510,8 +509,7 @@ class AdminModule extends PLModule case "u_kill": user_clear_all_subs($mr['user_id']); $page->trig("'{$mr['user_id']}' a été désinscrit !"); - require_once("diogenes/diogenes.hermes.inc.php"); - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setFrom("webmaster@polytechnique.org"); $mailer->addTo("web@polytechnique.org"); $mailer->setSubject("INTERVENTION de ".S::v('forlife')); diff --git a/modules/banana.php b/modules/banana.php index 116107a..7a88b9c 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -45,8 +45,7 @@ class BananaModule extends PLModule FROM auth_user_md5 WHERE promo={?}", $promo); list($effau, $effid) = $res->fetchOneRow(); if (5*$effau>$effid) { // + de 20% d'inscrits - require_once("xorg.mailer.inc.php"); - $mymail = new XOrgMailer('mails/forums.promo.tpl'); + $mymail = new PlMailer('mails/forums.promo.tpl'); $mymail->assign('promo', $promo); $mymail->send(); } diff --git a/modules/email.php b/modules/email.php index 19cd346..a1dc2e3 100644 --- a/modules/email.php +++ b/modules/email.php @@ -285,16 +285,13 @@ class EmailModule extends PLModule if (empty($to) && empty($cc) && empty($to2)) { $page->trig("Indique au moins un destinataire."); } else { - require_once("diogenes/diogenes.hermes.inc.php"); - - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom($from); $mymail->setSubject($subj); if (!empty($to)) { $mymail->addTo($to); } if (!empty($cc)) { $mymail->addCc($cc); } if (!empty($bcc)) { $mymail->addBcc($bcc); } if (!empty($to2)) { $mymail->addTo($to2); } - $mymail->addHeader('X-XOrg-Login', S::v('bestalias') . '@' . $globals->mail->domain); $mymail->setTxtBody(wordwrap($txt,72,"\n")); if ($mymail->send()) { $page->trig("Ton mail a bien été envoyé."); @@ -357,8 +354,7 @@ consulter la page <{$globals->baseurl}/emails/broken>. A bientôt sur Polytechnique.org ! L'équipe d'administration "; - require_once("diogenes/diogenes.hermes.inc.php"); - $mail = new HermesMailer(); + $mail = new PlMailer(); $mail->setFrom('"Polytechnique.org" '); $mail->addTo("$dest@polytechnique.org"); $mail->setSubject("Une de tes adresse de redirection Polytechnique.org ne marche plus !!"); diff --git a/modules/events.php b/modules/events.php index 89dcfa8..f7bb107 100644 --- a/modules/events.php +++ b/modules/events.php @@ -77,8 +77,7 @@ class EventsModule extends PLModule $page->addJsLink('close_on_esc.js'); if (Env::has('send')) { $page->assign('bug_sent',1); - require_once "diogenes/diogenes.hermes.inc.php"; - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom('"'.S::v('prenom').' '.S::v('nom').'" <'.S::v('bestalias').'@polytechnique.org>'); $mymail->addTo('support+platal@polytechnique.org'); $mymail->setSubject('Plat/al '.Env::v('task_type').' : '.Env::v('item_summary')); diff --git a/modules/lists.php b/modules/lists.php index 51c5d13..e2df76b 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -404,8 +404,7 @@ class ListsModule extends PLModule ." Sujet : « {$mail['subj']} »\n" ." Date : ".strftime("le %d %b %Y à %H:%M:%S", (int)$mail['stamp'])."\n\n" .$append; - require_once 'diogenes/diogenes.hermes.inc.php'; - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->addTo("$liste-owner@{$domain}"); $mailer->setFrom("$liste-bounces@{$domain}"); $mailer->addHeader('Reply-To', "$liste-owner@{$domain}"); diff --git a/modules/marketing.php b/modules/marketing.php index 842a8c3..894497b 100644 --- a/modules/marketing.php +++ b/modules/marketing.php @@ -186,8 +186,7 @@ class MarketingModule extends PLModule $email = trim(Post::v('mail')); if (Post::has('valide') && strlen($email) > 0) { - require_once('diogenes/diogenes.hermes.inc.php'); - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->setFrom(S::v('bestalias') . '@polytechnique.org'); $mailer->addTo('resetpass@polytechnique.org'); $mailer->setSubject("Proposition d'adresse mail pour " . $user['forlife']); diff --git a/modules/payment.php b/modules/payment.php index 834b818..d3e144a 100644 --- a/modules/payment.php +++ b/modules/payment.php @@ -21,7 +21,7 @@ /* sort en affichant une erreur */ function cb_erreur($text) { - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->addTo("telepaiement@polytechnique.org"); $mymail->setFrom("webmaster@polytechnique.org"); $mymail->setSubject("erreur lors d'un télépaiement (CyberPaiement)"); @@ -37,7 +37,7 @@ function paypal_erreur($text, $send=true) { $erreur = $text; if (!$send) return; - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->addTo("telepaiement@polytechnique.org"); $mymail->setFrom("webmaster@polytechnique.org"); $mymail->setSubject("erreur lors d'un télépaiement (PayPal)"); @@ -153,8 +153,6 @@ class PaymentModule extends PLModule function handler_cyber_return(&$page, $uid = null) { - require_once 'diogenes/diogenes.hermes.inc.php'; - /* reference banque (numero de transaction) */ $champ901 = clean_request('CHAMP901'); /* cle d'acceptation */ @@ -221,7 +219,7 @@ class PaymentModule extends PLModule $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom($conf_mail); $mymail->addTo("\"$prenom $nom\" <$forlife@polytechnique.org>"); $mymail->addCc($conf_mail); @@ -230,7 +228,7 @@ class PaymentModule extends PLModule $mymail->send(); /* on envoie les details de la transaction à telepaiement@ */ - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom("webmaster@polytechnique.org"); $mymail->addTo("telepaiement@staff.polytechnique.org"); $mymail->setSubject($conf_title); @@ -253,7 +251,6 @@ class PaymentModule extends PLModule } else { $page->changeTpl('payment/retour_paypal.tpl'); } - require_once 'diogenes/diogenes.hermes.inc.php'; /* reference banque (numero de transaction) */ $no_transaction = clean_request('tx'); @@ -315,7 +312,7 @@ class PaymentModule extends PLModule $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); $conf_text = str_replace("",$femme ? "Chère" : "Cher",$conf_text); - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom($conf_mail); $mymail->addTo("\"$prenom $nom\" <$forlife@polytechnique.org>"); $mymail->addCc($conf_mail); @@ -324,7 +321,7 @@ class PaymentModule extends PLModule $mymail->send(); /* on envoie les details de la transaction à telepaiement@ */ - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom("webmaster@polytechnique.org"); $mymail->addTo("telepaiement@polytechnique.org"); $mymail->setSubject($conf_title); diff --git a/modules/platal.php b/modules/platal.php index fbb7a65..d1cf8c6 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -269,8 +269,7 @@ class PlatalModule extends PLModule $res = XDB::query('SELECT email FROM emails WHERE uid = {?} AND NOT FIND_IN_SET("filter", flags)', $uid); $mails = implode(', ', $res->fetchColumn()); - require_once "diogenes/diogenes.hermes.inc.php"; - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom('"Gestion des mots de passe" '); $mymail->addTo($mails); $mymail->setSubject('Ton certificat d\'authentification'); diff --git a/modules/register.php b/modules/register.php index 002b7ef..6d73d7f 100644 --- a/modules/register.php +++ b/modules/register.php @@ -264,8 +264,7 @@ class RegisterModule extends PLModule global $platal; $platal->on_subscribe($forlife, $uid, $promo, $password); - require_once('xorg.mailer.inc.php'); - $mymail = new XOrgMailer('register/inscription.reussie.tpl'); + $mymail = new PlMailer('register/inscription.reussie.tpl'); $mymail->assign('forlife', $forlife); $mymail->assign('prenom', $prenom); $mymail->send(); @@ -287,8 +286,7 @@ class RegisterModule extends PLModule XDB::execute("UPDATE register_mstats SET success=NOW() WHERE uid={?}", $uid); while (list($salias, $snom, $sprenom, $sfemme) = $res->next()) { - require_once('diogenes/diogenes.hermes.inc.php'); - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setSubject("$prenom $nom s'est inscrit à Polytechnique.org !"); $mymail->setFrom('"Marketing Polytechnique.org" '); $mymail->addTo("\"$sprenom $snom\" <$salias@{$globals->mail->domain}>"); diff --git a/modules/xnet.php b/modules/xnet.php index ce9ed09..3eb6312 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -42,8 +42,7 @@ class XnetModule extends PLModule $page->addJsLink('close_on_esc.js'); if (Env::has('send')) { $page->assign('bug_sent',1); - require_once "diogenes/diogenes.hermes.inc.php"; - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom('"'.S::v('prenom').' '.S::v('nom').'" <'.S::v('bestalias').'@polytechnique.org>'); $mymail->addTo('support+platal@polytechnique.org'); $mymail->setSubject('Plat/al '.Env::v('task_type').' : '.Env::v('item_summary')); diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index af4f6ea..abb801f 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -476,8 +476,7 @@ class XnetGrpModule extends PLModule XDB::execute("INSERT INTO groupex.membres VALUES ({?}, {?}, 'membre', 'X', NULL, NULL, NULL, NULL, NULL)", $globals->asso('id'), $uid); - require_once 'diogenes/diogenes.hermes.inc.php'; - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->addTo("$u@polytechnique.org"); $mailer->setFrom('"'.S::v('prenom').' '.S::v('nom') .'" <'.S::v('forlife').'@polytechnique.org>'); @@ -495,8 +494,7 @@ class XnetGrpModule extends PLModule } elseif (Env::has('refuse')) { - require_once 'diogenes/diogenes.hermes.inc.php'; - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->addTo("$u@polytechnique.org"); $mailer->setFrom('"'.S::v('prenom').' '.S::v('nom') .'" <'.S::v('forlife').'@polytechnique.org>'); @@ -554,8 +552,7 @@ class XnetGrpModule extends PLModule ." résoudre ce problème.\n"; } - require_once 'diogenes/diogenes.hermes.inc.php'; - $mailer = new HermesMailer(); + $mailer = new PlMailer(); $mailer->addTo($to); $mailer->setFrom('"'.S::v('prenom').' '.S::v('nom') .'" <'.S::v('forlife').'@polytechnique.org>'); diff --git a/templates/mails/forums.promo.tpl b/templates/mails/forums.promo.tpl index e2f1bbf..13797b1 100644 --- a/templates/mails/forums.promo.tpl +++ b/templates/mails/forums.promo.tpl @@ -21,10 +21,12 @@ {**************************************************************************} {config_load file="mails.conf" section="forums_promo"} +{if !$html_version} {from full=#from#} {to addr=#to#} {subject text="Création du forum promo $promo"} Création du forum promo {$promo} à faire ! (+ de 20% d'inscrits) +{/if} {* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/mails/listes.promo.tpl b/templates/mails/listes.promo.tpl index 5f18f9e..55efb23 100644 --- a/templates/mails/listes.promo.tpl +++ b/templates/mails/listes.promo.tpl @@ -21,9 +21,11 @@ {**************************************************************************} {config_load file="mails.conf" section="listes_promo"} +{if !$html_version} {from full=#from#} {to addr=#to#} {subject text="Création de la liste promo $promo"} Création de la liste promo {$promo} à faire ! +{/if} {* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/marketing/mail.relance.tpl b/templates/marketing/mail.relance.tpl index b169086..c50e59c 100644 --- a/templates/marketing/mail.relance.tpl +++ b/templates/marketing/mail.relance.tpl @@ -21,6 +21,7 @@ {**************************************************************************} {config_load file="mails.conf" section="marketing_relance"} +{if !$html_version} {subject text="$subj"} {from full=#from#} {to addr="$lemail"} @@ -49,4 +50,5 @@ Bien cordialement, Polytechnique.org "Le portail des élèves & anciens élèves de l'Ecole polytechnique" +{/if} {* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/register/inscription.reussie.tpl b/templates/register/inscription.reussie.tpl index a1f3f71..2fdd5cf 100644 --- a/templates/register/inscription.reussie.tpl +++ b/templates/register/inscription.reussie.tpl @@ -21,6 +21,7 @@ {**************************************************************************} {config_load file="mails.conf" section="inscription"} +{if !$html_version} {from full=#from#} {to addr="$forlife@polytechnique.org"} {subject text="Bienvenue parmi les X sur le web !"} @@ -37,4 +38,5 @@ diffusion, aux infos promo, etc. N'oublie pas de mettre ta fiche-annuaire -- Polytechnique.org "Le portail des élèves & anciens élèves de l'Ecole polytechnique" +{/if} {* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/register/inscrire.mail.tpl b/templates/register/inscrire.mail.tpl index 43edea5..fe97376 100644 --- a/templates/register/inscrire.mail.tpl +++ b/templates/register/inscrire.mail.tpl @@ -21,6 +21,7 @@ {**************************************************************************} {config_load file="mails.conf" section="inscrire"} +{if !$html_version} {subject text="$subj"} {from full=#from#} {to addr="$lemail"} @@ -44,5 +45,5 @@ Nous esp Bien cordialement, Polytechnique.org "Le portail des élèves & anciens élèves de l'Ecole polytechnique" - +{/if} {* vim:set et sw=2 sts=2 sws=2: *} -- 2.1.4