Catch Exception when sending emails to users
This commit is contained in:
parent
bf4a818e01
commit
6e8dc642de
|
@ -8,9 +8,9 @@ use Engelsystem\Mail\EngelsystemMailer;
|
||||||
use Engelsystem\Models\News as NewsModel;
|
use Engelsystem\Models\News as NewsModel;
|
||||||
use Engelsystem\Models\User\Settings as UserSettings;
|
use Engelsystem\Models\User\Settings as UserSettings;
|
||||||
use Engelsystem\Models\User\User;
|
use Engelsystem\Models\User\User;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Mailer\Exception\TransportException;
|
|
||||||
|
|
||||||
class News
|
class News
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ class News
|
||||||
$template,
|
$template,
|
||||||
['title' => $news->title, 'news' => $news, 'username' => $user->displayName]
|
['title' => $news->title, 'news' => $news, 'username' => $user->displayName]
|
||||||
);
|
);
|
||||||
} catch (TransportException $e) {
|
} catch (Exception $e) {
|
||||||
$this->log->error(
|
$this->log->error(
|
||||||
'Unable to send email "{title}" to user {user} with {exception}',
|
'Unable to send email "{title}" to user {user} with {exception}',
|
||||||
['title' => $subject, 'user' => $user->name, 'exception' => $e]
|
['title' => $subject, 'user' => $user->name, 'exception' => $e]
|
||||||
|
|
Loading…
Reference in New Issue