|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
use Engelsystem\Mail\EngelsystemMailer;
|
|
|
|
use Engelsystem\Mail\EngelsystemMailer;
|
|
|
|
use Engelsystem\Models\User\User;
|
|
|
|
use Engelsystem\Models\User\User;
|
|
|
|
|
|
|
|
use Psr\Log\LogLevel;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param User $recipientUser
|
|
|
|
* @param User $recipientUser
|
|
|
@ -13,7 +14,7 @@ use Engelsystem\Models\User\User;
|
|
|
|
function engelsystem_email_to_user($recipientUser, $title, $message, $notIfItsMe = false)
|
|
|
|
function engelsystem_email_to_user($recipientUser, $title, $message, $notIfItsMe = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ($notIfItsMe && auth()->user()->id == $recipientUser->id) {
|
|
|
|
if ($notIfItsMe && auth()->user()->id == $recipientUser->id) {
|
|
|
|
#return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \Engelsystem\Helpers\Translator $translator */
|
|
|
|
/** @var \Engelsystem\Helpers\Translator $translator */
|
|
|
@ -31,8 +32,15 @@ function engelsystem_email_to_user($recipientUser, $title, $message, $notIfItsMe
|
|
|
|
'emails/mail',
|
|
|
|
'emails/mail',
|
|
|
|
['username' => $recipientUser->name, 'message' => $message]
|
|
|
|
['username' => $recipientUser->name, 'message' => $message]
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} catch(Exception $e) {
|
|
|
|
} catch (Exception $e) {
|
|
|
|
$status = 0;
|
|
|
|
$status = 0;
|
|
|
|
|
|
|
|
engelsystem_log(sprintf(
|
|
|
|
|
|
|
|
'An exception occurred while sending a mail to %s in %s:%u: %s',
|
|
|
|
|
|
|
|
$recipientUser->name,
|
|
|
|
|
|
|
|
$e->getFile(),
|
|
|
|
|
|
|
|
$e->getLine(),
|
|
|
|
|
|
|
|
$e->getMessage()
|
|
|
|
|
|
|
|
), LogLevel::CRITICAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$translator->setLocale($locale);
|
|
|
|
$translator->setLocale($locale);
|
|
|
|