2021-04-07
This commit is contained in:
@ -1,6 +1,46 @@
|
||||
<?php
|
||||
require_once 'log.php';
|
||||
|
||||
function getLang( $lang )
|
||||
{
|
||||
$dico = array();
|
||||
$fh = fopen('lang/'.$lang, 'r');
|
||||
$str = fgets($fh);
|
||||
fclose($fh);
|
||||
$dico = json_decode($str, true);
|
||||
return $dico;
|
||||
}
|
||||
|
||||
function courrielEnvoi( $db )
|
||||
{
|
||||
$dicoExpe = getLang( $db->expeLang );
|
||||
$dicoDest = getLang( $db->destLang );
|
||||
$expediteurIndex = "Notification_denvoi_Expediteur";
|
||||
//print "envoi du courriel" . EOL;
|
||||
if ( $db->expeKnown == false )
|
||||
{
|
||||
$destinataireIndex = "Notification_denvoi_Destinataire_ExpediteurConnu";
|
||||
}else
|
||||
{
|
||||
$destinataireIndex = "Notification_denvoi_Destinataire_ExpediteurAnonyme";
|
||||
}
|
||||
$indexObjet = "Objet_" . $expediteurIndex;
|
||||
$objetMail = $dicoExpe[$indexObjet];
|
||||
$mailText = $dicoExpe[$expediteurIndex] .EOL .EOL ;
|
||||
|
||||
envoiMail( $db->expeMail, $objetMail, $mailText, true);
|
||||
|
||||
$indexObjet = "Objet_" . $destinataireIndex;
|
||||
$objetMail = $dicoExpe[$indexObjet];
|
||||
$mailText = $dicoExpe[$destinataireIndex] .EOL .EOL ;
|
||||
//sleep (1);
|
||||
envoiMail( $db->destMail, $objetMail, $mailText, true);
|
||||
}
|
||||
|
||||
function courrielArrivee($uid)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
function envoiMail($destinataire, $sujet, $text, $html=false)
|
||||
{
|
||||
@ -16,16 +56,17 @@ function envoiMail($destinataire, $sujet, $text, $html=false)
|
||||
$headers .= "DATE: " . date( 'r' ) . LF . LF;
|
||||
|
||||
log_write(__FILE__ . __LINE__ . " Envoi d'un courriel à " . $text . "sujet:" . $sujet, INFO);
|
||||
if( !mail($destinataire, $sujet, $text, $headers) ) //Sending mail
|
||||
if( !mail($destinataire, $sujet, wordwrap($text, 70 , "\r\n"), $headers) ) //Sending mail
|
||||
{
|
||||
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel n'est pas parti:" .$text . EOL . $sujet . EOL, ERROR);
|
||||
return 0;
|
||||
}else
|
||||
{
|
||||
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel avec les pièces jointes est parti:" .$text . EOL, INFO);
|
||||
log_write(__FILE__ . EOL . __LINE__ . EOL . "Le courriel est parti:" .$text . EOL, INFO);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user