production/Cron/Emaildivers.php
2025-12-01 16:12:12 +00:00

108 lines
2.2 KiB
PHP
Executable File

<?php
require_once 'Functions.php';
require_once 'Controleurrequete.php';
require_once 'Destinataire.php';
class Emaildivers
{
private $destinataire;
private $mail_C;
public function __construct()
{
$this->destinataire = new Destinataire();
require_once 'Ebenegmail.php';
$this->mail_C = $mail;
}
public function excutercron()
{
// echo "Emaildivers";
// exit();
$destinataires = $this->destinataire->listedestinataires();
$compteur = 0;
foreach ($destinataires as $destinataire)
{
$compteur += 1;
/*
if($compteur>4)
{
echo "FIN Emaildivers";
exit();
}
*/
// $codePrestataire = $prestataire['codePrestataire'];
// $libelle = $prestataire['libelle'];
$email = $destinataire['email'];
// Pour tester
// $email = "lkane@ebene.info";
// echo "$compteur $codePrestataire $libelle $email ";
// echo '</BR>'; echo '</BR>';
// Fin tests */
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
$mail_C = $this->mail_C;
$mail_C->ClearAllRecipients();
$mail_C->clearAttachments();
$addr = explode(';', $email);
foreach ($addr as $ad)
{
$mail_C->AddAddress(trim($ad) );
}
$mail_C->AddCC("prugira@radiant.rw");
$mail_C->AddCC("imugabo@radiant.rw");
// $mail_C->AddCC("lkane@ebene.info");
$obejt = "RADIANT INSURANCE COMPANY : INFORMATION";
$body = "Mufatanyabikorwa wacu,
Tunejejwe no kubamenyesha ko redressement igiye kujya ikorerwa muri systeme yacu nshya ya Intersante.Turabasaba ko mwaduha Email adresse ndetse na numero ya telephone tuzajya twoherezaho ubutumwa igihe hari facture yarangiye ikeneye redressement.
Mugire akazi keza.
Murakoze.";
$mail_C->Subject = $obejt;
$mail_C->AltBody = $altbody;
$mail_C->Body=$body;
// var_dump($mail_C);
if (!$mail_C->send())
{
// echo "Erreur mail : " . $mail_C->ErrorInfo;
}
else
{
// echo "Message envoyé!";
}
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
}
}
}
// echo '</BR>'; echo '</BR>';
$emaildivers = new Emaildivers();
// date_default_timezone_set("Africa/Kigali");
$emaildivers->excutercron();
echo "Fin Tache Cron";