Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lib/MailQueueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public function __construct(
/**
* Send an email to {$limit} users
*
* @param $limit Number of users we want to send an email to
* @param $sendTime The latest send time
* @param $forceSending Ignores latest send and just sends all emails
* @param $restrictEmails null or one of UserSettings::EMAIL_SEND_*, will overwrite force send
* @param int $limit Number of users we want to send an email to
* @param int $sendTime The latest send time
* @param bool $forceSending Ignores latest send and just sends all emails
* @param int|null $restrictEmails null or one of UserSettings::EMAIL_SEND_*, will overwrite force send
* @return int Number of users we sent an email to
*/
public function sendEmails(int $limit, int $sendTime, bool $forceSending = false, ?int $restrictEmails = null): int {
Expand All @@ -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
Expand Down
Loading