| Current Path : /home/happyrenas/old/huissier-express.fr/administration/panel/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/old/huissier-express.fr/administration/panel/constat_envoi_mail_huissiers.php |
<?
session_start();
$page="constat";
include("../../config.php");
require_once('includes/class.phpmailer.php');
require_once('includes/class.smtp.php');
$constat_id = $_REQUEST['constat_id'];
$dernier_huissier_id = "";
$laliste = $_REQUEST['laliste'];
$lesmails = explode("\n", $laliste);
foreach ($lesmails as $lemail)
{
if ($lemail) {$matrice[]=$lemail;}
}
echo "<pre>";
print_r($matrice);
echo "</pre>";
if ($constat_id)
{
//SPECS CONSTAT
$myquery = "SELECT * from constat where id=".$constat_id;
$constat = $db->get_row($myquery);
$type_constat = $tableau_constat_type[$constat->constat_type];
if ($constat->constat_type==20)
{
$type_constat="Autre constat";
$laprecision=" <br><small>".$constat->laprecision."</small>";
}
$date_creation = date("d-m-Y", strtotime($constat->date_creation));
if ($constat->choix==1)
{
$texte="<b>Plage jour : </b>".$tableau_plage_jour[$constat->plage_jour]."<br>";
$texte.="<b>Plage heure : </b>".$tableau_plage_heure[$constat->plage_heure]."<br>";
if ($constat->plage_urgence) {$texte.="<b>Plage urgence : </b>".$tableau_plage_urgence[$constat->plage_urgence]."<br>";}
}
if ($constat->choix==2)
{
$texte="";
if ($constat->date_choix!="0000-00-00") {$texte.="Date souhaitée : ".$constat->date_choix;}
if ($constat->heure_choix!="0000-00-00") {$texte.="Heure souhaitée : ".$constat->heure_choix;}
}
$constat_lieu = $constat->constat_cp." ".$constat->constat_ville;
$constat_tarif = $constat->tarif;
//FIN SPECS CONSTAT
$myquery = "SELECT * from huissier where (departement = ".$constat->constat_departement." || zone1=".$constat->constat_departement." || zone2=".$constat->constat_departement." || zone3=".$constat->constat_departement." ||zone4=".$constat->constat_departement.") AND statut=1 order by id";
//echo $myquery."<br>";
$myquery_calls = $db->get_results($myquery);
if (!empty($myquery_calls))
{
foreach ( $myquery_calls as $huissiers )
{
if ($huissiers->id!=$dernier_huissier_id)
{
$variable_envoi=0;
if ($matrice)
{
foreach ($matrice as $value)
{
if (trim($value)==trim($huissiers->mail)) {$variable_envoi=1;}
}
}
if ($variable_envoi==1)
{
$from ="resa@huissier-express.fr";
$from_name ="huissier-express.fr";
$reply ="resa@huissier-express.fr";
$destinataire = $huissiers->mail;
$password_huissier = $huissiers->password;
$huissier_id = $huissiers->id;
$mail_huissier = $huissiers->mail;
$objet = "Vous avez reçu une demande de constat urgent";
include("modele_constat_envoi_mail_huissiers.php");
$mail = new PHPmailer(True);
try {
$mail->CharSet = "UTF-8";
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->setFrom($from,$from_name);
$mail->AddAddress($destinataire);
//$mail->AddBCC("contact@huissier-express.fr");
//$mail->AddBCC("lemondeavance@gmail.com");
$mail->AddReplyTo($reply);
$mail->IsHTML(true);
$mail->Subject=$objet;
$mail->Body=$message;
$mail->Send();
// SUCCES
echo "Notification envoyee<br>";
$requete="UPDATE constat set envoi_mail = 1 where id =".$constat_id;
//echo $requete."<br>";
$db->query($requete);
}
catch (phpmailerException $e)
{
echo "<br><b>".$e->errorMessage()."</b><br>"; //Pretty error messages from PHPMailer
}
catch (Exception $e)
{
echo "<br><b>".$e->getMessage()."</b><br>"; //Boring error messages from anything else!
}
}
unset($mail);
}
}
}
}
?>