Skip to content
Merged
Changes from 1 commit
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
Next Next commit
handle mail send error gracefully
log the error in case a notification mail of a new share couldn't
be send to the recipient and finish the share operation successfully

Signed-off-by: Bjoern Schiessle <[email protected]>
  • Loading branch information
schiessle authored and Backportbot committed Jan 30, 2019
commit 2dcab24f8ceec4b586fbd9fe998cf070bf0f3b67
15 changes: 13 additions & 2 deletions lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ public function createShare(\OCP\Share\IShare $share) {
* @param string $initiator user ID of share sender
* @param string $shareWith email address of share receiver
* @param \DateTime|null $expiration
* @throws \Exception If mail couldn't be sent
* @return bool
*/
protected function sendMailNotification(IL10N $l,
$filename,
Expand Down Expand Up @@ -773,7 +773,18 @@ protected function sendMailNotification(IL10N $l,
}

$message->useTemplate($emailTemplate);
$this->mailer->send($message);
try {
$failedRecipients = $this->mailer->send($message);
if(!empty($failedRecipients)) {
$this->logger->error('Share notification mail could not be send to: ' . implode(', ', $failedRecipients));
return false;
}
} catch (\Exception $e) {
$this->logger->error('Share notification mail could not be send: ' . $e->getMessage());
return false;
}

return true;
}

/**
Expand Down