diff options
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/MailSettingsController.php | 5 | ||||
-rw-r--r-- | settings/Hooks.php | 14 | ||||
-rw-r--r-- | settings/Mailer/NewUserMailHelper.php | 5 |
3 files changed, 10 insertions, 14 deletions
diff --git a/settings/Controller/MailSettingsController.php b/settings/Controller/MailSettingsController.php index 974a95618ad..02bd51e843e 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,9 +159,7 @@ class MailSettingsController extends Controller { $message = $this->mailer->createMessage(); $message->setTo([$email => $displayName]); - $message->setSubject($this->l10n->t('Email setting test')); - $message->setHtmlBody($template->renderHtml()); - $message->setPlainBody($template->renderText()); + $message->useTemplate($template); $errors = $this->mailer->send($message); if (!empty($errors)) { throw new \RuntimeException($this->l10n->t('Email could not be sent. Check your mail server log')); diff --git a/settings/Hooks.php b/settings/Hooks.php index 6f537796517..59bd7bb905d 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,10 +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->setBody($template->renderText(), 'text/plain'); - $message->setHtmlBody($template->renderHtml()); - + $message->useTemplate($template); $this->mailer->send($message); } } @@ -193,6 +192,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,10 +205,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->setBody($template->renderText(), 'text/plain'); - $message->setHtmlBody($template->renderHtml()); - + $message->useTemplate($template); $this->mailer->send($message); } } diff --git a/settings/Mailer/NewUserMailHelper.php b/settings/Mailer/NewUserMailHelper.php index c111ffeb4fa..935b3f0e075 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,10 +160,8 @@ 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->setHtmlBody($emailTemplate->renderHtml()); - $message->setPlainBody($emailTemplate->renderText()); $message->setFrom([$this->fromAddress => $this->themingDefaults->getName()]); + $message->useTemplate($emailTemplate); $this->mailer->send($message); } } |