diff options
author | Joas Schilling <coding@schilljs.com> | 2017-09-15 10:59:11 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-10-18 15:12:03 +0200 |
commit | 8b37fe7f6534ad16bd9a357036e95e748e2068e3 (patch) | |
tree | c7a11a26232a0e117d0b2b3c95a2d79b7985967b /apps/sharebymail/lib/ShareByMailProvider.php | |
parent | f109c1a10c9f5acf0d5d3e4f864e3702f99db937 (diff) | |
download | nextcloud-server-8b37fe7f6534ad16bd9a357036e95e748e2068e3.tar.gz nextcloud-server-8b37fe7f6534ad16bd9a357036e95e748e2068e3.zip |
Set the subject with the email template to allow theming
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/sharebymail/lib/ShareByMailProvider.php')
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 516e4e243bf..6e0664a8147 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -380,8 +380,6 @@ class ShareByMailProvider implements IShareProvider { \DateTime $expiration = null) { $initiatorUser = $this->userManager->get($initiator); $initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator; - $subject = (string)$this->l->t('%s shared »%s« with you', array($initiatorDisplayName, $filename)); - $message = $this->mailer->createMessage(); $emailTemplate = $this->mailer->createEMailTemplate('sharebymail.RecipientNotification', [ @@ -392,6 +390,7 @@ class ShareByMailProvider implements IShareProvider { 'shareWith' => $shareWith, ]); + $emailTemplate->setSubject($this->l->t('%s shared »%s« with you', array($initiatorDisplayName, $filename))); $emailTemplate->addHeader(); $emailTemplate->addHeading($this->l->t('%s shared »%s« with you', [$initiatorDisplayName, $filename]), false); $text = $this->l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]); @@ -428,7 +427,7 @@ class ShareByMailProvider implements IShareProvider { $emailTemplate->addFooter(); } - $message->setSubject($subject); + $message->setSubject($emailTemplate->renderSubject()); $message->setPlainBody($emailTemplate->renderText()); $message->setHtmlBody($emailTemplate->renderHtml()); $this->mailer->send($message); @@ -455,7 +454,6 @@ class ShareByMailProvider implements IShareProvider { $initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator; $initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null; - $subject = (string)$this->l->t('Password to access »%s« shared to you by %s', [$filename, $initiatorDisplayName]); $plainBodyPart = $this->l->t("%s shared »%s« with you.\nYou should have already received a separate mail with a link to access it.\n", [$initiatorDisplayName, $filename]); $htmlBodyPart = $this->l->t('%s shared »%s« with you. You should have already received a separate mail with a link to access it.', [$initiatorDisplayName, $filename]); @@ -468,6 +466,8 @@ class ShareByMailProvider implements IShareProvider { 'initiatorEmail' => $initiatorEmailAddress, 'shareWith' => $shareWith, ]); + + $emailTemplate->setSubject($this->l->t('Password to access »%s« shared to you by %s', [$filename, $initiatorDisplayName])); $emailTemplate->addHeader(); $emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false); $emailTemplate->addBodyText($htmlBodyPart, $plainBodyPart); @@ -491,7 +491,7 @@ class ShareByMailProvider implements IShareProvider { } $message->setTo([$shareWith]); - $message->setSubject($subject); + $message->setSubject($emailTemplate->renderSubject()); $message->setBody($emailTemplate->renderText(), 'text/plain'); $message->setHtmlBody($emailTemplate->renderHtml()); $this->mailer->send($message); @@ -524,7 +524,6 @@ class ShareByMailProvider implements IShareProvider { ); } - $subject = (string)$this->l->t('Password to access »%s« shared with %s', [$filename, $shareWith]); $bodyPart = $this->l->t("You just shared »%s« with %s. The share was already send to the recipient. Due to the security policies defined by the administrator of %s each share needs to be protected by password and it is not allowed to send the password directly to the recipient. Therefore you need to forward the password manually to the recipient.", [$filename, $shareWith, $this->defaults->getName()]); $message = $this->mailer->createMessage(); @@ -536,6 +535,7 @@ class ShareByMailProvider implements IShareProvider { 'shareWith' => $shareWith, ]); + $emailTemplate->setSubject($this->l->t('Password to access »%s« shared with %s', [$filename, $shareWith])); $emailTemplate->addHeader(); $emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false); $emailTemplate->addBodyText($bodyPart); @@ -547,7 +547,7 @@ class ShareByMailProvider implements IShareProvider { $message->setFrom([$initiatorEMailAddress => $initiatorDisplayName]); } $message->setTo([$initiatorEMailAddress => $initiatorDisplayName]); - $message->setSubject($subject); + $message->setSubject($emailTemplate->renderSubject()); $message->setBody($emailTemplate->renderText(), 'text/plain'); $message->setHtmlBody($emailTemplate->renderHtml()); $this->mailer->send($message); |