From 3af8abb0983b201c2b2fb412b44592a9a512582d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 6 Jun 2017 14:17:04 +0200 Subject: [PATCH] Allow to overwrite the email template again Signed-off-by: Joas Schilling --- config/config.sample.php | 7 +++++++ lib/private/Mail/Mailer.php | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/config/config.sample.php b/config/config.sample.php index 27499825c6..9cff1a4b87 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -966,6 +966,13 @@ $CONFIG = array( */ 'systemtags.managerFactory' => '\OC\SystemTag\ManagerFactory', +/** + * Replaces the default mail template layout. This can be utilized if the + * options to modify the mail texts with the theming app is not enough. + * The class must extend ``\OC\Mail\EMailTemplate`` + */ +'mail_template_class' => '\OC\Mail\EMailTemplate', + /** * Maintenance * diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index 80988d8570..b24f72316b 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -90,6 +90,16 @@ class Mailer implements IMailer { } public function createEMailTemplate() { + $class = $this->config->getSystemValue('mail_template_class', ''); + + if ($class !== '' && class_exists($class) && is_a($class, EMailTemplate::class, true)) { + return new $class( + $this->defaults, + $this->urlGenerator, + $this->l10n + ); + } + return new EMailTemplate( $this->defaults, $this->urlGenerator,