Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1575 alexandre_ 1
<?php
2
// +------------------------------------------------------------------------------------------------------+
3
// | PHP version 4.1                                                                                      |
4
// +------------------------------------------------------------------------------------------------------+
5
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// +------------------------------------------------------------------------------------------------------+
7
// | This library is free software; you can redistribute it and/or                                        |
8
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | License as published by the Free Software Foundation; either                                         |
10
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// |                                                                                                      |
12
// | This library is distributed in the hope that it will be useful,                                      |
13
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | Lesser General Public License for more details.                                                      |
16
// |                                                                                                      |
17
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | License along with this library; if not, write to the Free Software                                  |
19
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// +------------------------------------------------------------------------------------------------------+
21
// CVS : $Id: lettre_actu.php,v 1.1 2007-09-06 08:39:41 alexandre_tb Exp $
22
/**
23
* Envoi d un lettre d actualite
24
*
25
* Ce fichier peut etre appele par un cron, et utilise le fichier de conf du bottin
26
* La lettre est une page externe en HTML ou texte simple appele via une URL
27
*
28
* En tant qu application hors papyrus, il faut indiquer les parametres de connexion
29
* a la base de donnee dans bottin.config.inc.php
30
*@package bottin
31
//Auteur original :
32
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
33
//Autres auteurs :
34
*@author        David Delon <david.delon@clapas.net>
35
*@copyright     Tela-Botanica 2000-2007
36
*@version       $Revision: 1.1 $ $Date: 2007-09-06 08:39:41 $
37
// +------------------------------------------------------------------------------------------------------+
38
*/
39
 
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
43
 
44
include_once 'configuration/bottin.config.inc.php';
45
include_once 'Mail.php' ;
46
include_once 'Mail/mime.php' ;
47
 
48
// +------------------------------------------------------------------------------------------------------+
49
// |                                            CORPS du PROGRAMME                                        |
50
// +------------------------------------------------------------------------------------------------------+
51
 
52
// On recupere la ou les differentes configurations d inscription
53
echo 'Bottin : envoi de la lettre d\'actualité'."\n";
54
$requete = 'select * from inscription_configuration';
55
$resultat = $GLOBALS['ins_db']->query($requete);
56
if (DB::isError($resultat)) echo $resultat->getMessage();
57
 
58
 
59
$mail = & Mail::factory ('mail') ;
60
 
61
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
62
	if ($ligne->ic_mail_news_url != '' && $ligne->ic_mail_news != '') {
63
		$lettre_info_html = file_get_contents($ligne->ic_mail_news_url);
64
		$crlf="\n";
65
 
66
		$headers ['From'] = $ligne->ic_mail_news_from ;
67
		$headers ['Subject'] = $ligne->ic_mail_news_sujet ;
68
		$headers ['Reply-To'] = $ligne->ic_mail_news_reply_to ;
69
		$mime = new Mail_mime($crlf);
70
 
71
		$mime->setHTMLBody($lettre_info_html);
72
 
73
		$body = $mime->get();
74
		$headers = $mime->headers($headers);
75
		$retour = $mail -> send ($ligne->ic_mail_news, $headers, $body) ;
76
		echo 'Envoi d\'un mail à : '.$ligne->ic_mail_news."\n";
77
		if (PEAR::isError ($retour)) {
78
    		echo 'erreur d\'envoi' ;
79
		}
80
	}
81
}
82
 
83
/* +--Fin du code ----------------------------------------------------------------------------------------+
84
*
85
* $Log: not supported by cvs2svn $
86
 
87
* +-- Fin du code ----------------------------------------------------------------------------------------+
88
*/
89
 
90
?>