diff options
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 14 | ||||
-rw-r--r-- | core/Controller/LostController.php | 3 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 4 | ||||
-rw-r--r-- | settings/Controller/MailSettingsController.php | 3 | ||||
-rw-r--r-- | settings/Hooks.php | 8 | ||||
-rw-r--r-- | settings/Mailer/NewUserMailHelper.php | 3 |
6 files changed, 21 insertions, 14 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); diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 4c59b0a1c00..f4400b0f20b 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -309,6 +309,7 @@ class LostController extends Controller { 'link' => $link, ]); + $emailTemplate->setSubject($this->l10n->t('%s password reset', [$this->defaults->getName()])); $emailTemplate->addHeader(); $emailTemplate->addHeading($this->l10n->t('Password reset')); @@ -327,7 +328,7 @@ class LostController extends Controller { try { $message = $this->mailer->createMessage(); $message->setTo([$email => $user->getUID()]); - $message->setSubject($this->l10n->t('%s password reset', [$this->defaults->getName()])); + $message->setSubject($emailTemplate->renderSubject()); $message->setPlainBody($emailTemplate->renderText()); $message->setHtmlBody($emailTemplate->renderHtml()); $message->setFrom([$this->from => $this->defaults->getName()]); diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index b2e192b8309..dd2a110daeb 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -702,7 +702,6 @@ class Manager implements IManager { \DateTime $expiration = null) { $initiatorUser = $this->userManager->get($initiator); $initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator; - $subject = $l->t('%s shared »%s« with you', array($initiatorDisplayName, $filename)); $message = $this->mailer->createMessage(); @@ -714,6 +713,7 @@ class Manager implements IManager { 'shareWith' => $shareWith, ]); + $emailTemplate->setSubject($l->t('%s shared »%s« with you', array($initiatorDisplayName, $filename))); $emailTemplate->addHeader(); $emailTemplate->addHeading($l->t('%s shared »%s« with you', [$initiatorDisplayName, $filename]), false); $text = $l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]); @@ -750,7 +750,7 @@ class Manager implements IManager { $emailTemplate->addFooter(); } - $message->setSubject($subject); + $message->setSubject($emailTemplate->renderSubject()); $message->setPlainBody($emailTemplate->renderText()); $message->setHtmlBody($emailTemplate->renderHtml()); $this->mailer->send($message); diff --git a/settings/Controller/MailSettingsController.php b/settings/Controller/MailSettingsController.php index 974a95618ad..cb622fa9b12 100644 --- a/settings/Controller/MailSettingsController.php +++ b/settings/Controller/MailSettingsController.php @@ -151,6 +151,7 @@ class MailSettingsController extends Controller { 'displayname' => $displayName, ]); + $template->setSubject($this->l10n->t('Email setting test')); $template->addHeader(); $template->addHeading($this->l10n->t('Well done, %s!', [$displayName])); $template->addBodyText($this->l10n->t('If you received this email, the email configuration seems to be correct.')); @@ -158,7 +159,7 @@ class MailSettingsController extends Controller { $message = $this->mailer->createMessage(); $message->setTo([$email => $displayName]); - $message->setSubject($this->l10n->t('Email setting test')); + $message->setSubject($template->renderSubject()); $message->setHtmlBody($template->renderHtml()); $message->setPlainBody($template->renderText()); $errors = $this->mailer->send($message); diff --git a/settings/Hooks.php b/settings/Hooks.php index 6f537796517..3da85b4ae74 100644 --- a/settings/Hooks.php +++ b/settings/Hooks.php @@ -122,6 +122,8 @@ class Hooks { 'emailAddress' => $user->getEMailAddress(), 'instanceUrl' => $instanceUrl, ]); + + $template->setSubject($this->l->t('Password for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl])); $template->addHeader(); $template->addHeading($this->l->t('Password changed for %s', [$user->getDisplayName()]), false); $template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.')); @@ -130,7 +132,7 @@ class Hooks { $message = $this->mailer->createMessage(); $message->setTo([$user->getEMailAddress() => $user->getDisplayName()]); - $message->setSubject($this->l->t('Password for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl])); + $message->setSubject($template->renderSubject()); $message->setBody($template->renderText(), 'text/plain'); $message->setHtmlBody($template->renderHtml()); @@ -193,6 +195,8 @@ class Hooks { 'oldEMailAddress' => $oldMailAddress, 'instanceUrl' => $instanceUrl, ]); + + $template->setSubject($this->l->t('Email address for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl])); $template->addHeader(); $template->addHeading($this->l->t('Email address changed for %s', [$user->getDisplayName()]), false); $template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.')); @@ -204,7 +208,7 @@ class Hooks { $message = $this->mailer->createMessage(); $message->setTo([$oldMailAddress => $user->getDisplayName()]); - $message->setSubject($this->l->t('Email address for %1$s changed on %2$s', [$user->getDisplayName(), $instanceUrl])); + $message->setSubject($template->renderSubject()); $message->setBody($template->renderText(), 'text/plain'); $message->setHtmlBody($template->renderHtml()); diff --git a/settings/Mailer/NewUserMailHelper.php b/settings/Mailer/NewUserMailHelper.php index c111ffeb4fa..af1627a08e3 100644 --- a/settings/Mailer/NewUserMailHelper.php +++ b/settings/Mailer/NewUserMailHelper.php @@ -124,6 +124,7 @@ class NewUserMailHelper { 'resetTokenGenerated' => $generatePasswordResetToken, ]); + $emailTemplate->setSubject($this->l10n->t('Your %s account was created', [$this->themingDefaults->getName()])); $emailTemplate->addHeader(); if ($displayName === $userId) { $emailTemplate->addHeading($this->l10n->t('Welcome aboard')); @@ -159,7 +160,7 @@ class NewUserMailHelper { IEMailTemplate $emailTemplate) { $message = $this->mailer->createMessage(); $message->setTo([$user->getEMailAddress() => $user->getDisplayName()]); - $message->setSubject($this->l10n->t('Your %s account was created', [$this->themingDefaults->getName()])); + $message->setSubject($emailTemplate->renderSubject()); $message->setHtmlBody($emailTemplate->renderHtml()); $message->setPlainBody($emailTemplate->renderText()); $message->setFrom([$this->fromAddress => $this->themingDefaults->getName()]); |