diff --git a/lib/MailQueueHandler.php b/lib/MailQueueHandler.php index e7ed24cb1..e63b188ac 100644 --- a/lib/MailQueueHandler.php +++ b/lib/MailQueueHandler.php @@ -91,7 +91,13 @@ public function sendEmails(int $limit, int $sendTime, bool $forceSending = false continue; } - $userObject = $this->userManager->get($user); + try { + $userObject = $this->userManager->get($user); + } catch (\Exception $e) { + $this->logger->error('An error happened while trying to find ' . $user . ', skipping', ['exception' => $e]); + continue; + } + $email = $userObject ? $userObject->getEMailAddress() : ''; if (empty($email)) { // The user did not setup an email address