diff --git a/lib/MailNotifications.php b/lib/MailNotifications.php index 77fbc3899..3f8c9bac5 100644 --- a/lib/MailNotifications.php +++ b/lib/MailNotifications.php @@ -89,6 +89,13 @@ public function sendEmails(int $batchSize, int $sendTime): void { $batchTime = $defaultBatchTime; } + if ($batchTime === 0) { + // Mails are off, so drop the user from the queue of the background job + $settings->setNextSendTime(0); + $this->settingsMapper->update($settings); + continue; + } + $userId = $settings->getUserId(); if (isset($userEnabled[$userId]) && $userEnabled[$userId] === 'false') { // User is disabled, skip sending the email for them