Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
448 ddelon 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: mail_tous.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
23
/**
24
* Permet d'envoie un mail à une sélection dans l'annuaire
25
*
26
*
27
*@package annuaire
28
//Auteur original :
29
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
//Autres auteurs :
31
*@author        Aucun
32
*@copyright     Tela-Botanica 2000-2004
33
*@version       $Revision: 1.1 $
34
// +------------------------------------------------------------------------------------------------------+
35
*/
36
 
37
// +------------------------------------------------------------------------------------------------------+
38
// |                                            ENTETE du PROGRAMME                                       |
39
// +------------------------------------------------------------------------------------------------------+
40
 
41
function putFrame() {
42
 
43
    // configuration
44
    global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN ;
45
    global $action ;
46
 
47
    $url = $GLOBALS['ann_url']->getURL() ;
48
 
49
    $annu_table = "annuaire_tela" ;
50
    $champs_mail = "U_MAIL" ;
51
 
52
    // Entete
53
 
54
    $corps_debut = "RESEAU TELA BOTANICA - Le ".date("j/m/Y").
55
                    "\n\nBonjour,\n"."\n\nCordialement,\n-------------------\nTela Botanica le réseau des botanistes francophones\naccueil@tela-botanica.org\nhttp://www.tela-botanica.org\n";
56
 
57
    $res = "<h1>Envoi d'un mail &agrave; tous les membres</h1>\n" ;
58
 
59
    if ($_GET['action'] == ANN_MAIL_TOUS_ENVOIE) $res .= envoie_mail_selection() ;
60
 
61
    // formulaire
62
    $res .= "<div><form action=\"$url&action=".ANN_MAIL_TOUS_ENVOIE."\" method=\"post\"><table>\n" ;
63
    $res .= "<tr><td class=\"insLabel\">" ;
64
    $res .= "Objet&nbsp;:&nbsp;</td><td><input size=\"91\" name=\"objet\" type=\"text\" class=\"insInputForm\"></td></tr>\n" ;
65
    $res .= "<tr><td class=\"insLabel\">Corps&nbsp;:&nbsp;</td><td><textarea name=\"corps\" cols=\"90\" rows=\"30\" class=\"insInputForm\">$corps_debut</textarea></td></tr>\n" ;
66
    $res .= "<tr><td></td><td><input type=\"submit\" class=\"texte_tb\" value=\"envoyer\"" ;
67
    $res .= " onclick=\"javascript:return confirm('Etes-vous sur de vouloir envoyer ce message !!');\"" ;
68
    $res .= "></td></tr>\n" ;
69
    $res .= "</table></form></div>\n" ;
70
 
71
return $res ;
72
}
73
 
74
include_once ("Mail.php");
75
 
76
// envoie le mail à tous
77
 
78
 
79
function envoie_mail_selection()
80
{
81
    global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN, $GS_GLOBAL ;
82
 
83
    $annuaire = "annuaire_tela" ;
84
    $champs_mail = "U_MAIL" ;
85
 
86
    $headers['From']    = "accueil@tela-botanica.org" ;
87
    $headers['Subject'] = stripslashes($objet) ;
88
 
89
    $corps = stripslashes($corps) ;
90
 
91
    $requete = $_SESSION['requete_mail_tous'] ;
92
    unset ($_SESSION['requete_mail_tous']) ;
93
 
94
    $resultat = mysql_query($requete) or die ("echec") ;
95
 
96
    while ($ligne = mysql_fetch_object($resultat)) {
97
        if (!mail($ligne->U_MAIL, $headers['Subject'], $corps, "From: ".$headers['From'])) {
98
        return "<tr><td>Une erreur s'est produite:<br>".$mail_object->getMessage()."</td></tr>\n" ;
99
        }
100
    }
101
 
102
    return "<div>Le mail est parti !</div>\n";
103
 
104
}
105
?>