Merge pull request #16189 from nextcloud/backport/16183/stable16

[stable16] Do not fail hard on new user mail error
This commit is contained in:
Roeland Jago Douma 2019-07-04 12:23:02 +02:00 committed by GitHub
commit 33f44c9024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -306,12 +306,13 @@ class UsersController extends AUserData {
$emailTemplate = $this->newUserMailHelper->generateTemplate($newUser, $generatePasswordResetToken);
$this->newUserMailHelper->sendMail($newUser, $emailTemplate);
} catch (\Exception $e) {
// Mail could be failing hard or just be plain not configured
// Logging error as it is the hardest of the two
$this->logger->logException($e, [
'message' => "Can't send new user mail to $email",
'message' => "Unable to send the invitation mail to $email",
'level' => ILogger::ERROR,
'app' => 'ocs_api',
]);
throw new OCSException('Unable to send the invitation mail', 109);
}
}