Verified Commit 6db030a0 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(Integrator) - mailLib replacing mailControler in orchestrator

New library mailLib allowing orchestrator to send mail.
parent 8c223668
2 merge requests!52:sparkles: Releasing Fusiondirectory Integrator 1.2,!43Resolve "[Integrator] - Create MailLib to be used by orchestrator instead of the mailController."
Pipeline #29502 failed with stages
in 1 minute and 36 seconds
Showing with 10 additions and 2 deletions
+10 -2
<?php <?php
namespace FusionDirectory\Mail;
use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\Exception;
class MailController class MailLib
{ {
protected string $setFrom; protected string $setFrom;
...@@ -100,7 +102,7 @@ class MailController ...@@ -100,7 +102,7 @@ class MailController
try { try {
$this->mail->send(); $this->mail->send();
} catch (Exception $e) { } catch (\Exception $e) {
$errors[] = $this->mail->ErrorInfo; $errors[] = $this->mail->ErrorInfo;
} }
......
...@@ -10,6 +10,12 @@ spl_autoload_register(function ($class) { ...@@ -10,6 +10,12 @@ spl_autoload_register(function ($class) {
// Simple array to keep track of which classes have already been loaded. // Simple array to keep track of which classes have already been loaded.
static $classes = []; static $classes = [];
if (strpos($class, 'PHPMailer') !== FALSE) {
require_once("/usr/share/php/libphp-phpmailer/src/Exception.php");
require_once("/usr/share/php/libphp-phpmailer/src/PHPMailer.php");
require_once("/usr/share/php/libphp-phpmailer/src/SMTP.php");
}
// Avoids re-loading classes that have already been loaded. // Avoids re-loading classes that have already been loaded.
if (array_key_exists($class, $classes)) { if (array_key_exists($class, $classes)) {
return; return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment