diff --git a/plugins/tasks/Notifications.php b/plugins/tasks/Notifications.php index 3856226de23a5da37205d3f64ad1284d652ddbcb..a01196c58b922eedd92b707d2145801d5b3e45bd 100644 --- a/plugins/tasks/Notifications.php +++ b/plugins/tasks/Notifications.php @@ -6,11 +6,13 @@ class Notifications implements EndpointInterface private TaskGateway $gateway; private string $errorMessage = 'No matching audited attributes with monitored attributes, safely removed!'; private Utils $utils; + private MailUtils $mailUtils; public function __construct (TaskGateway $gateway) { $this->gateway = $gateway; $this->utils = new Utils(); + $this->mailUtils = new MailUtils(); } /** @@ -320,19 +322,14 @@ class Notifications implements EndpointInterface foreach ($notifications as $data) { $numberOfRecipients = count($data['mailForm']['recipients']); - - $mail_controller = new \FusionDirectory\Mail\MailLib( - $data['mailForm']['setFrom'], - NULL, - $data['mailForm']['recipients'], - $data['mailForm']['body'], - $data['mailForm']['signature'], - $data['mailForm']['subject'], - $data['mailForm']['receipt'], - NULL - ); - - $mailSentResult = $mail_controller->sendMail(); + $setFrom = $data['mailForm']['setFrom']; + $recipients = $data['mailForm']['recipients']; + $body = $data['mailForm']['body']; + $signature = $data['mailForm']['signature']; + $subject = $data['mailForm']['subject']; + $receipt = $data['mailForm']['receipt']; + + $mailSentResult = $this->mailUtils->sendMail($setFrom, NULL, $recipients, $body, $signature, $subject, $receipt, NULL); $result[] = $this->processMailResponseAndUpdateTasks($mailSentResult, $data, $fdTasksConf); // Verification anti-spam max mails to be sent and quit loop if matched.