bug 420, nom d'epouse sur le trombi promo
[platal.git] / include / xnet / mail.inc.php
index ad5f4d2..4555f24 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  Copyright (C) 2003-2006 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -23,7 +23,7 @@ require_once 'diogenes/diogenes.hermes.inc.php';
 
 // {{{ get_all_redirects
 
-function get_all_redirects($membres, $mls, $alias, &$client)
+function get_all_redirects($membres, $mls, &$client)
 {
     global $globals;
     
@@ -45,7 +45,7 @@ function get_all_redirects($membres, $mls, $alias, &$client)
     foreach ($mls as $ml) {
         if (list(,$members) = $client->get_members($ml)) {
             foreach ($members as $mem) {
-                list($m, $dom) = split('@',$mem[1]);
+                list($m, $dom) = explode('@',$mem[1]);
                 if ($dom == $globals->mail->domain || $dom == $globals->mail->domain2) {
                     $res = $globals->xdb->query('SELECT  prenom, nom, FIND_IN_SET("femme", u.flags) AS sexe
                                                    FROM  auth_user_md5 AS u
@@ -74,7 +74,7 @@ function get_all_redirects($membres, $mls, $alias, &$client)
 // }}}
 // {{{ _send_xnet_mail
 
-function _send_xnet_mail($user, $body, $mailer)
+function _send_xnet_mail($user, $body, $mailer, $replyto = null)
 {
     $cher = isset($user['sexe']) ? ($user['sexe'] ? 'Chère' : 'Cher') : 'Cher(e)';
     $nom  = isset($user['nom']) ? $user['nom'] : "";
@@ -87,6 +87,9 @@ function _send_xnet_mail($user, $body, $mailer)
     $text = preg_replace('!<prenom>!i', $pnom, $text);
 
     $mailer->addHeader('To', $to);
+    if ($replyto) {
+        $mailer->addHeader('Reply-To', $replyto);
+    }
     $mailer->setTxtBody(wordwrap($text, 72));
     $mailer->send();
 }
@@ -94,7 +97,7 @@ function _send_xnet_mail($user, $body, $mailer)
 // }}}
 // {{{ send_xnet_mails
 
-function send_xnet_mails($from, $sujet, $body, $tos)
+function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null)
 {
     $sent = array();
 
@@ -104,7 +107,7 @@ function send_xnet_mails($from, $sujet, $body, $tos)
 
     foreach ($tos as $user) {
         if ($sent[$user['email']]) continue;
-        _send_xnet_mail($user, $body, $mailer);
+        _send_xnet_mail($user, $body, $mailer, $replyto);
         $sent[$user['email']] = true;
     }
 }