Skip to content

Commit

Permalink
Add validation for sender email address
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Dec 3, 2019
1 parent dde7694 commit c4c59aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/36505
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: enhance validation for sender e-mail address for e-mail notifications

In case an user wanted to use the e-mail notification mechanism in order to notify other users when creating public links as well as internal shares, an error was triggered if the e-mail address for this user was not set. The behavior has now been fixed.

https://github.com/owncloud/core/pull/36505
9 changes: 8 additions & 1 deletion lib/private/Share/MailNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ public function sendInternalShareMail($sender, $node, $shareType, $recipientList
'internal',
$recipientL10N
);
$replyTo = $sender->getEMailAddress();
if (empty($replyTo)) {
$replyTo = Util::getDefaultEmailAddress('sharing-noreply');
}

// send it out now
try {
Expand All @@ -192,7 +196,7 @@ public function sendInternalShareMail($sender, $node, $shareType, $recipientList
$message->setHtmlBody($htmlBody);
$message->setPlainBody($textBody);
$message->setFrom($this->getFrom($this->l, $filter->getSenderDisplayName()));
$message->setReplyTo([$sender->getEMailAddress()]);
$message->setReplyTo([$replyTo]);

$this->mailer->send($message);
} catch (\Exception $e) {
Expand Down Expand Up @@ -264,6 +268,9 @@ public function sendLinkShareMail($sender, $recipients, $link, $personalNote = n
);
$from = $this->getFrom($l10n, $filter->getSenderDisplayName());
$replyTo = $sender->getEMailAddress();
if (empty($replyTo)) {
$replyTo = Util::getDefaultEmailAddress('sharing-noreply');
}

$event = new GenericEvent(null, ['link' => $link, 'to' => $recipientsAsString]);
$this->eventDispatcher->dispatch('share.sendmail', $event);
Expand Down

0 comments on commit c4c59aa

Please sign in to comment.