On gere les mails html dans le module adhérent
This commit is contained in:
parent
0ab789c7bf
commit
bff4082705
@ -116,11 +116,17 @@ class Adherent
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Fonction envoyant un email au destinataire (recipient) avec le text fourni en parametre.
|
\brief Fonction envoyant un email a l'adherent avec le texte fourni en parametre.
|
||||||
\param recipients destinataires
|
\param text contenu du message
|
||||||
\param text contenu du message
|
\param subject sujet du message
|
||||||
\param subject sujet du message
|
\param filename_list tableau de fichiers attachés
|
||||||
\return int <0 si ko, >0 si ok
|
\param mimetype_list tableau des types des fichiers attachés
|
||||||
|
\param mimefilename_list tableau des noms des fichiers attachés
|
||||||
|
\param addr_cc email cc
|
||||||
|
\param addr_bcc email bcc
|
||||||
|
\param deliveryreceipt demande accusé réception
|
||||||
|
\param msgishtml 1=message is a html message, 0=message is not html, 2=auto detect
|
||||||
|
\return int <0 si ko, >0 si ok
|
||||||
\remarks La particularite de cette fonction est de remplacer certains champs
|
\remarks La particularite de cette fonction est de remplacer certains champs
|
||||||
\remarks par leur valeur pour l'adherent en l'occurrence :
|
\remarks par leur valeur pour l'adherent en l'occurrence :
|
||||||
\remarks %PRENOM% : est remplace par le prenom
|
\remarks %PRENOM% : est remplace par le prenom
|
||||||
@ -129,7 +135,9 @@ class Adherent
|
|||||||
\remarks %SERVEUR% : URL du serveur web
|
\remarks %SERVEUR% : URL du serveur web
|
||||||
\remarks etc..
|
\remarks etc..
|
||||||
*/
|
*/
|
||||||
function send_an_email($recipients,$text,$subject="Vos coordonnees sur %SERVEUR%")
|
function send_an_email($text,$subject,
|
||||||
|
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
||||||
|
$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0, $errors_to='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -163,6 +171,16 @@ class Adherent
|
|||||||
$infos.= $langs->trans("Photo").": $this->photo\n";
|
$infos.= $langs->trans("Photo").": $this->photo\n";
|
||||||
$infos.= $langs->trans("Public").": ".yn($this->public)."\n";
|
$infos.= $langs->trans("Public").": ".yn($this->public)."\n";
|
||||||
|
|
||||||
|
// Is it an HTML Content ?
|
||||||
|
$html = $msgishtml;
|
||||||
|
if ($msgishtml == 2)
|
||||||
|
{
|
||||||
|
if (eregi('<html',$text)) $html = 1;
|
||||||
|
elseif (eregi('<body',$text)) $html = 1;
|
||||||
|
elseif (eregi('<br',$text)) $html = 1;
|
||||||
|
}
|
||||||
|
if ($html) $infos = nl2br($infos);
|
||||||
|
|
||||||
$replace = array (
|
$replace = array (
|
||||||
$this->prenom,
|
$this->prenom,
|
||||||
$this->nom,
|
$this->nom,
|
||||||
@ -181,7 +199,6 @@ class Adherent
|
|||||||
);
|
);
|
||||||
$texttosend = preg_replace ($patterns, $replace, $text);
|
$texttosend = preg_replace ($patterns, $replace, $text);
|
||||||
$subjectosend = preg_replace ($patterns, $replace, $subject);
|
$subjectosend = preg_replace ($patterns, $replace, $subject);
|
||||||
$msgishtml=0;
|
|
||||||
|
|
||||||
// Envoi mail confirmation
|
// Envoi mail confirmation
|
||||||
include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||||
@ -190,8 +207,8 @@ class Adherent
|
|||||||
if ($conf->global->ADHERENT_MAIL_FROM) $from=$conf->global->ADHERENT_MAIL_FROM;
|
if ($conf->global->ADHERENT_MAIL_FROM) $from=$conf->global->ADHERENT_MAIL_FROM;
|
||||||
|
|
||||||
$mailfile = new CMailFile($subjectosend,$this->email,$from,$texttosend,
|
$mailfile = new CMailFile($subjectosend,$this->email,$from,$texttosend,
|
||||||
array(),array(),array(),
|
$filename_list,$mimetype_list,$mimefilename_list,
|
||||||
'', '', 0, $msgishtml);
|
$addr_cc, $addr_bcc, $deliveryreceipt, $html);
|
||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -142,7 +142,7 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio
|
|||||||
// Envoi mail
|
// Envoi mail
|
||||||
if ($_POST["sendmail"])
|
if ($_POST["sendmail"])
|
||||||
{
|
{
|
||||||
$result=$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
|
$result=$adh->send_an_email($conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT,array(),array(),array(),"","",0,2);
|
||||||
if ($result < 0) $errmsg=$adh->error;
|
if ($result < 0) $errmsg=$adh->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,7 @@ if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
|
|||||||
|
|
||||||
if ($adh->email)
|
if ($adh->email)
|
||||||
{
|
{
|
||||||
$result=$adh->send_an_email($adh->email,"Voici le contenu de votre fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent");
|
$result=$adh->send_an_email("Voici le contenu de votre fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,11 +410,11 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_valid' && $_P
|
|||||||
{
|
{
|
||||||
if (isset($adht->mail_valid) && $adht->mail_valid)
|
if (isset($adht->mail_valid) && $adht->mail_valid)
|
||||||
{
|
{
|
||||||
$result=$adh->send_an_email($adh->email,$adht->mail_valid,$conf->adherent->email_valid_subject);
|
$result=$adh->send_an_email($adht->mail_valid,$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result=$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_VALID,$conf->global->ADHERENT_MAIL_VALID_SUBJECT);
|
$result=$adh->send_an_email($conf->global->ADHERENT_MAIL_VALID,$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
|
||||||
}
|
}
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -460,7 +460,7 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_resign' &
|
|||||||
{
|
{
|
||||||
if ($adh->email && $_POST["send_mail"])
|
if ($adh->email && $_POST["send_mail"])
|
||||||
{
|
{
|
||||||
$result=$adh->send_an_email($adh->email,$conf->adherent->email_resil,$conf->adherent->email_resil_subject);
|
$result=$adh->send_an_email($conf->global->ADHERENT_MAIL_RESIL,$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,2);
|
||||||
}
|
}
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -439,40 +439,6 @@ class Conf
|
|||||||
$this->mailing->email_from=$conf->global->MAILING_EMAIL_FROM;
|
$this->mailing->email_from=$conf->global->MAILING_EMAIL_FROM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->adherent->email_resil, ...
|
|
||||||
if (defined("MAIN_MAIL_RESIL"))
|
|
||||||
{
|
|
||||||
$this->adherent->email_resil=MAIN_MAIL_RESIL;
|
|
||||||
}
|
|
||||||
if (defined("MAIN_MAIL_RESIL_SUBJECT"))
|
|
||||||
{
|
|
||||||
$this->adherent->email_resil_subject=MAIN_MAIL_RESIL_SUBJECT;
|
|
||||||
}
|
|
||||||
if (defined("MAIN_MAIL_VALID"))
|
|
||||||
{
|
|
||||||
$this->adherent->email_valid=MAIN_MAIL_VALID;
|
|
||||||
}
|
|
||||||
if (defined("MAIN_MAIL_VALID_SUBJECT"))
|
|
||||||
{
|
|
||||||
$this->adherent->email_valid_subject=MAIN_MAIL_VALID_SUBJECT;
|
|
||||||
}
|
|
||||||
if (defined("MAIN_MAIL_EDIT"))
|
|
||||||
{
|
|
||||||
$this->adherent->email_edit=MAIN_MAIL_EDIT;
|
|
||||||
}
|
|
||||||
if (defined("MAIN_MAIL_EDIT_SUBJECT"))
|
|
||||||
{
|
|
||||||
$this->adherent->email_edit_subject=MAIN_MAIL_EDIT_SUBJECT;
|
|
||||||
}
|
|
||||||
if (defined("MAIN_MAIL_NEW"))
|
|
||||||
{
|
|
||||||
$this->adherent->email_new=MAIN_MAIL_NEW;
|
|
||||||
}
|
|
||||||
if (defined("MAIN_MAIL_NEW_SUBJECT"))
|
|
||||||
{
|
|
||||||
$this->adherent->email_new_subject=MAIN_MAIL_NEW_SUBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Defini MAIN_GRAPH_LIBRARY
|
// Defini MAIN_GRAPH_LIBRARY
|
||||||
if (! in_array($this->global->MAIN_GRAPH_LIBRARY, array('phplot','artichow')))
|
if (! in_array($this->global->MAIN_GRAPH_LIBRARY, array('phplot','artichow')))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class CMailFile
|
|||||||
\param addr_cc email cc
|
\param addr_cc email cc
|
||||||
\param addr_bcc email bcc
|
\param addr_bcc email bcc
|
||||||
\param deliveryreceipt demande accusé réception
|
\param deliveryreceipt demande accusé réception
|
||||||
\param msgishtml message is a html message
|
\param msgishtml 1=message is a html message, 0=message is not html, 2=auto detect
|
||||||
*/
|
*/
|
||||||
function CMailFile($subject,$to,$from,$msg,
|
function CMailFile($subject,$to,$from,$msg,
|
||||||
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
||||||
@ -99,7 +99,17 @@ class CMailFile
|
|||||||
if (eregi('^mac',PHP_OS)) $this->eol="\r";
|
if (eregi('^mac',PHP_OS)) $this->eol="\r";
|
||||||
|
|
||||||
// On defini si message HTML
|
// On defini si message HTML
|
||||||
$this->msgishtml = $msgishtml;
|
if ($msgishtml == 2)
|
||||||
|
{
|
||||||
|
$this->msgishtml = 0;
|
||||||
|
if (eregi('<html',$msg)) $this->msgishtml = 1;
|
||||||
|
elseif (eregi('<body',$msg)) $this->msgishtml = 1;
|
||||||
|
elseif (eregi('<br',$msg)) $this->msgishtml = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->msgishtml = $msgishtml;
|
||||||
|
}
|
||||||
|
|
||||||
$smtp_headers = "";
|
$smtp_headers = "";
|
||||||
$mime_headers = "";
|
$mime_headers = "";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user