prestataire = new Prestataire(); require_once 'Ebenegmail.php'; $this->mail_C = $mail; } public function excutercron() { // $prestataires = $this->prestataire->listemailprestataire(); // $prestataires = $this->prestataire->listemailprestatairedoublon(); $prestataires = $this->prestataire->listemailprestatairepublic(); $compteur = 0; foreach ($prestataires as $prestataire) { // codePrestataire, libelle, email $compteur += 1; $codePrestataire = $prestataire['codePrestataire']; $libelle = $prestataire['libelle']; $email = $prestataire['email']; // Pour tester // $email = "lkane@ebene.info"; // echo "$compteur $codePrestataire $libelle $email "; // echo '
'; echo '
'; // Fin tests */ // DEBUT ENVOI DU MAIL AVEC PIECE JOINTE $mail_C = $this->mail_C; $mail_C->ClearAllRecipients(); // $mail_C->clearAttachments(); // pour envoi à moi seul // $email = "kanelazeni@gmail.com"; // fin envoi à moi seul $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 = "Ku bafanyabikorwa bacu mu bwishingizi bwo kwivuza, Muraho.Dushingiye ku itegeko rishya rigenga imisoro ryasohotse mu I Gazeti numero ….yo ku wa 16/04/2018, mu ngingo yayo ya 60, twifuzaga gusaba abafatanyabikorwa bacu bose ko mwatugezaho byihutirwa C.I.T(COPERATE INCOME TAX ) (UMUSORO KUNYUNGU ) Kugirango tubashe kwishyura twubahiriza itegeko kandi twirinda ingaruka zabaho igihe amategeko atubahirijwe. Twizeye ko mubyakira neza, mugire amahoro"; $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 '
'; echo '
'; $emailprestataires = new Emailprestatairespublics(); // date_default_timezone_set("Africa/Kigali"); $emailprestataires->excutercron(); echo "Fin Tache Cron";