From fa304196afe47f5cafe7f858a6b30d509a79dc07 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 27 Nov 2025 17:54:11 +0530 Subject: [PATCH] FIX_Mail 3rd and 4th (In the client notification email feature, comma-separated emails currently send to the first address with others in CC. We need all emails sent as individual TO recipients so they cannot see each other's addresses.) --- app/Controllers/NotificationController.php | 46 ++-- app/Views/notification.php | 291 +++++++++++++-------- app/Views/ticket_form_gmc.php | 1 + 3 files changed, 213 insertions(+), 125 deletions(-) diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php index 98067fa9..e288a7a0 100755 --- a/app/Controllers/NotificationController.php +++ b/app/Controllers/NotificationController.php @@ -217,40 +217,44 @@ class NotificationController extends AdminController } // This function for sent a mail for testing - public function sentTestMail($template_id, $test_mail) + // keep watching this + public function sentTestMail($template_id, $test_mail, $string_flag) { $notification_data = $this->notificationModel->where('id', $template_id)->first(); + + + if(empty($notification_data)) { + return $this->respond(['status' => false,'code' => 200, 'message' => 'Notification Template not enabled']); + } + $client_data = $this->clientModel->where('id', $notification_data['client_id'])->where('is_active', 1)->first(); - if(!empty($notification_data)){ - - $params = [ + $params = [ 'client_data' => $client_data, 'notification_data' => $notification_data, 'test_mail' => $test_mail - ]; + ]; - $testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params); - // print_r($testMailData); die; - if (!empty($testMailData)) { + $testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params); - $mail_send_return1 = MailHelper::send_email($testMailData); - $this->myLogger->logme("info", $mail_send_return1); - $this->myLogger->logme("info", $mail_send_return1); + if(empty($testMailData)) { + return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']); + } - return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]); - - }else{ - - return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']); - } - }else{ - - return $this->respond(['status' => false,'code' => 200, 'message' => 'Notification Template not enabled']); + if($string_flag == "send"){ + $mail_send_return1 = MailHelper::send_email($testMailData); + $this->myLogger->logme("info", $mail_send_return1); + return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]); + } + if($string_flag == "preview"){ + return $this->respond([ + 'status' => true, + 'code' => 200, + 'content' => $testMailData + ]); } } - public function sendCommonTestMail() diff --git a/app/Views/notification.php b/app/Views/notification.php index 341871ec..5248c2bf 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -342,7 +342,7 @@ - +