Blame | Last modification | View Log | RSS feed
<?php
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: lettre_actu.php,v 1.1 2007-09-06 08:39:41 alexandre_tb Exp $
/**
* Envoi d un lettre d actualite
*
* Ce fichier peut etre appele par un cron, et utilise le fichier de conf du bottin
* La lettre est une page externe en HTML ou texte simple appele via une URL
*
* En tant qu application hors papyrus, il faut indiquer les parametres de connexion
* a la base de donnee dans bottin.config.inc.php
*@package bottin
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author David Delon <david.delon@clapas.net>
*@copyright Tela-Botanica 2000-2007
*@version $Revision: 1.1 $ $Date: 2007-09-06 08:39:41 $
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
include_once 'configuration/bottin.config.inc.php';
include_once 'Mail.php' ;
include_once 'Mail/mime.php' ;
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// On recupere la ou les differentes configurations d inscription
echo 'Bottin : envoi de la lettre d\'actualité'."\n";
$requete = 'select * from inscription_configuration';
$resultat = $GLOBALS['ins_db']->query($requete);
if (DB::isError($resultat)) echo $resultat->getMessage();
$mail = & Mail::factory ('mail') ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
if ($ligne->ic_mail_news_url != '' && $ligne->ic_mail_news != '') {
$lettre_info_html = file_get_contents($ligne->ic_mail_news_url);
$crlf="\n";
$headers ['From'] = $ligne->ic_mail_news_from ;
$headers ['Subject'] = $ligne->ic_mail_news_sujet ;
$headers ['Reply-To'] = $ligne->ic_mail_news_reply_to ;
$mime = new Mail_mime($crlf);
$mime->setHTMLBody($lettre_info_html);
$body = $mime->get();
$headers = $mime->headers($headers);
$retour = $mail -> send ($ligne->ic_mail_news, $headers, $body) ;
echo 'Envoi d\'un mail à : '.$ligne->ic_mail_news."\n";
if (PEAR::isError ($retour)) {
echo 'erreur d\'envoi' ;
}
}
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>