From 12bdfb8b94e8b62dcf3a2e1d72054753ae9f1e3b Mon Sep 17 00:00:00 2001 From: Sarobidy22 Date: Fri, 7 Nov 2025 13:53:36 +0300 Subject: [PATCH] 06112025 --- app/Helpers/alerts_helper.php | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/app/Helpers/alerts_helper.php b/app/Helpers/alerts_helper.php index 0c494223..072b3a51 100644 --- a/app/Helpers/alerts_helper.php +++ b/app/Helpers/alerts_helper.php @@ -260,7 +260,7 @@ function checkAndConvertCompletedAvances() /** - * Envoyer un email via Brevo + * ✅ Envoyer un email via Brevo (configuration hardcodée pour éviter dépendance .env) */ function sendEmailWithBrevo($to, $subject, $message) { @@ -269,14 +269,14 @@ function sendEmailWithBrevo($to, $subject, $message) $email = \Config\Services::email(); - // Configuration Brevo depuis le fichier .env + // ✅ Configuration Brevo hardcodée (pas besoin du .env) $config = [ - 'protocol' => env('email.protocol', 'smtp'), - 'SMTPHost' => env('email.SMTPHost', 'smtp-relay.brevo.com'), - 'SMTPUser' => env('email.SMTPUser'), - 'SMTPPass' => env('email.SMTPPass'), - 'SMTPPort' => env('email.SMTPPort', 587), - 'SMTPCrypto' => env('email.SMTPCrypto', 'tls'), + 'protocol' => 'smtp', + 'SMTPHost' => 'smtp-relay.brevo.com', + 'SMTPUser' => '8356e1002@smtp-brevo.com', + 'SMTPPass' => '2JT0KhZOfgSVQk9D', + 'SMTPPort' => 587, + 'SMTPCrypto' => 'tls', 'mailType' => 'html', 'charset' => 'utf-8', 'newline' => "\r\n", @@ -288,11 +288,8 @@ function sendEmailWithBrevo($to, $subject, $message) $email->initialize($config); - // Utilisation de l'email configuré dans .env - $fromEmail = env('email.fromEmail', 'noreply@motorbike.mg'); - $fromName = env('email.fromName', 'Système Motorbike - Alertes'); - - $email->setFrom($fromEmail, $fromName); + // ✅ Configuration expéditeur hardcodée + $email->setFrom('noreply@motorbike.mg', 'Système Motorbike - Alertes'); $email->setTo($to); $email->setSubject($subject); $email->setMessage($message); @@ -305,11 +302,11 @@ function sendEmailWithBrevo($to, $subject, $message) return false; } - log_message('info', "Email envoyé avec succès via Brevo à: {$to}"); + log_message('info', "✅ Email envoyé avec succès via Brevo à: {$to}"); return true; } catch (\Exception $e) { - log_message('error', "Exception email Brevo à {$to}: " . $e->getMessage()); + log_message('error', "❌ Exception email Brevo à {$to}: " . $e->getMessage()); log_message('error', "Stack trace: " . $e->getTraceAsString()); return false; }