Skip to content

Commit

Permalink
Merge pull request #5302 from nextcloud/fix_5047
Browse files Browse the repository at this point in the history
use the email address configured in Nextcloud as sender instead of the users email address
  • Loading branch information
nickvergessen authored Jun 13, 2017
2 parents c46422b + 1ef8ea5 commit b7761be
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,24 @@ protected function sendPassword(IShare $share, $password) {
$emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false);
$emailTemplate->addBodyText($htmlBodyPart, $plainBodyPart);
$emailTemplate->addBodyText($this->l->t('It is protected with the following password: %s', [$password]));
$emailTemplate->addFooter();

// The "From" contains the sharers name
$instanceName = $this->defaults->getName();
$senderName = $this->l->t(
'%s via %s',
[
$initiatorDisplayName,
$instanceName
]
);
$message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]);
if ($initiatorEmailAddress !== null) {
$message->setFrom([$initiatorEmailAddress => $initiatorDisplayName]);
$message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]);
$emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan());
} else {
$emailTemplate->addFooter();
}

$message->setTo([$shareWith]);
$message->setSubject($subject);
$message->setBody($emailTemplate->renderText(), 'text/plain');
Expand Down

0 comments on commit b7761be

Please sign in to comment.