diff --git a/composer.json b/composer.json index 4575a670200ee102e1ca1f4102967bac8b3884e8..60e59eaf26cdad0a8e7939b01a931224917ce4c8 100755 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "require": { "unicaen/privilege": "^6.0", "laminas/laminas-dependency-plugin": "^2.2", - "php": "^8.0" + "php": "^7.0" }, "autoload": { "psr-0": [], diff --git a/config/unicaen-mail.local.php.dist b/config/unicaen-mail.local.php.dist index d61547446abcb9fde311889ccea51fb41f5e8c88..8d133388c9a5c58f8af98604d64b719dc0cd68f7 100644 --- a/config/unicaen-mail.local.php.dist +++ b/config/unicaen-mail.local.php.dist @@ -1,8 +1,6 @@ <?php /** * Configuration locale du module UnicaenMail. - * If you have a ./config/autoload/ directory set up for your project, - * drop this config file in it and change the values as you wish. */ use UnicaenMail\Entity\Db\Mail; @@ -45,7 +43,7 @@ return [ ] ], - 'server_url' => 'http://xxx.xxx', + 'server_url' => 'https://xxx.xxx', // 'service_manager' => [ // 'delegators' => [ // TreeRouteStack::class => [ diff --git a/src/UnicaenMail/Service/Mail/MailService.php b/src/UnicaenMail/Service/Mail/MailService.php index 21e90df2f7b4077eebc328051477554e70d2f6e9..43dfcc569c3692379dcf5fe3ff1388097cbe4158 100644 --- a/src/UnicaenMail/Service/Mail/MailService.php +++ b/src/UnicaenMail/Service/Mail/MailService.php @@ -147,9 +147,10 @@ class MailService { */ public function fetchValueFromConfig(string $key, ?string $module = null) { - $value = ($module)?$this->config['module'][$module][$key]:null; - if ($value === null) $value = $this->config['default'][$key]; - if ($value === null) $value = $this->config[$key]; + $config = $this->config['module']; + $value = ($module)?$config[$module][$key]:null; + if ($value === null) $value = $config['default'][$key]; + if ($value === null) $value = $config[$key]; if ($value === null) { throw new NotFoundConfigException("Aucun valeur de trouver dans la configuration de UnicaenMail pour la clef [".$key."]"); @@ -194,7 +195,11 @@ class MailService { $message = (new Message())->setEncoding('UTF-8'); $message->setFrom($fromEmail, $fromName); - $message->setTo($to); + if ($doNotSend) { + $message->setTo($redirectTo); + } else { + $message->setTo($to); + } $message->setSubject($sujet); $texte = "<p><i>Ce courrier électronique vous a été adressé <strong>automatiquement</strong> par l'application ".$subjectPrefix.". </i></p>" . $texte; $mail->setCorps($texte);