diff --git a/app/Repositories/ToolRepository.php b/app/Repositories/ToolRepository.php
index d84518fd..69de55ba 100644
--- a/app/Repositories/ToolRepository.php
+++ b/app/Repositories/ToolRepository.php
@@ -316,7 +316,7 @@ class ToolRepository extends BaseRepository
* @param $body
* @return bool
*/
- public function sendMail($to, $subject, $body): bool
+ public function sendMail($to, $subject, $body, $exception = false): bool
{
$log = "[SEND_MAIL]";
$factory = new EsmtpTransportFactory();
@@ -353,7 +353,11 @@ class ToolRepository extends BaseRepository
return true;
} catch (\Throwable $e) {
do_log("$log, fail: " . $e->getMessage() . "\n" . $e->getTraceAsString(), 'error');
- return false;
+ if ($exception) {
+ throw $e;
+ } else {
+ return false;
+ }
}
}
diff --git a/include/constants.php b/include/constants.php
index bbcbb174..37608b46 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -1,6 +1,6 @@
sendMail($email, $title, $body, true);
+ stderr($lang_mailtest['std_success'], $lang_mailtest['std_success_note']);
+ } catch (\Throwable $e) {
+ stderr($lang_functions['std_error'], $lang_functions['text_unable_to_send_mail'] . sprintf("
%s", $e->getMessage()), false);
+ }
}
else
{