diff --git a/lib/MailQueueHandler.php b/lib/MailQueueHandler.php index 3b44e63ae..e0642487a 100644 --- a/lib/MailQueueHandler.php +++ b/lib/MailQueueHandler.php @@ -34,7 +34,7 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; -use OCP\L10N\IFactory; +use OCP\L10N\IFactory; use OCP\Mail\IMailer; use OCP\RichObjectStrings\InvalidObjectExeption; use OCP\RichObjectStrings\IValidator; @@ -375,6 +375,12 @@ protected function sendEmailToUser($userName, $email, $lang, $timezone, $maxTime $message->useTemplate($template); $message->setFrom([$this->getSenderData('email') => $this->getSenderData('name')]); + if(method_exists($message, 'setAutoSubmitted')){ + $message->setAutoSubmitted(\OCP\Mail\AutoSubmittedValue::AUTO_GENERATED); + } else { + $message->getSwiftMessage()->getHeaders()->addTextHeader('Auto-Submitted', 'auto-generated'); + } + try { $this->mailer->send($message); } catch (\Exception $e) {