From f7bd962d5310db2d7d19a0f44f0da08edee2046f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Bl=C3=BCm?= Date: Wed, 11 Apr 2018 09:59:39 +0200 Subject: [PATCH 1/3] Update email-template docs --- .../email_configuration.rst | 54 ++----------------- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/admin_manual/configuration_server/email_configuration.rst b/admin_manual/configuration_server/email_configuration.rst index 3b6937c5c..5d6f76688 100644 --- a/admin_manual/configuration_server/email_configuration.rst +++ b/admin_manual/configuration_server/email_configuration.rst @@ -79,57 +79,9 @@ place, in your mail server configuration. Using email templates --------------------- -Another useful new feature is editable email templates. Now you can edit -Nextcloud's email templates on your Admin page. These are your available -templates: - -* Sharing email (HTML) -- HTML version of emails notifying users of new file - shares - -* Sharing email (plain text fallback) -- Plain text email notifying users of new file shares - -* Lost password mail -- Password reset email for users who lose their passwords. - -* Activity notification mail -- Notification of activities that users have - enabled in the Notifications section of their Personal pages. - -In addition to providing the email templates, this feature enables you to apply -any preconfigured themes to the email. - -To modify an email template to users: - -1. Access the Admin page. - -2. Scroll to the Mail templates section. - -3. Select a template from the drop-down menu. - -4. Make any desired modifications to the template. - -The templates are written in PHP and HTML, and are already loaded with the -relevant variables such as username, share links, and filenames. You can, if you -are careful, edit these even without knowing PHP or HTML; don't touch any of the -code, but you can edit the text portions of the messages. For example, this the -lost password mail template: - -:: - - t('Use the following link to - reset your password: {link}')); - -You could change the text portion of the template, ``Use the following link to -reset your password:`` to say something else, such as ``Click the following link -to reset your password. If you did not ask for a password reset, ignore this -message.`` - -Again, be very careful to change nothing but the message text, because the -tiniest coding error will break the template. - -.. note:: You can edit the templates directly in the template text box, or you - can copy and paste them to a text editor for modification and then copy and - paste them back to the template text box for use when you are done. +With Nextcloud 12 we have introduced a new way of customizing email templates. +You will find the documentation in our support portal: +`support portal `_ Setting mail server parameters in config.php -------------------------------------------- From 7fed523087590f2d728a86958d782ec0c45d9732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Bl=C3=BCm?= Date: Wed, 11 Apr 2018 12:07:42 +0200 Subject: [PATCH 2/3] More details --- .../email_configuration.rst | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/admin_manual/configuration_server/email_configuration.rst b/admin_manual/configuration_server/email_configuration.rst index 5d6f76688..6bd8fd0e4 100644 --- a/admin_manual/configuration_server/email_configuration.rst +++ b/admin_manual/configuration_server/email_configuration.rst @@ -79,9 +79,59 @@ place, in your mail server configuration. Using email templates --------------------- -With Nextcloud 12 we have introduced a new way of customizing email templates. -You will find the documentation in our support portal: -`support portal `_ +We removed the template editor in Nextcloud 12 because we changed how emails +are generated. While the customization capabilities offered by the template editor +were easy to use, they often resulted in broken emails. To fix this, we designed a +much easier mechanism that automatically generates emails which follow the theme +settings and look the same in all the different email clients out there. + +.. note:: If, for some reason, you need text-only emails, consider simply configuring + this on the client side or let the receiving (or even sending) mail server drop the + HTML part. Note that there is no security impact from **sending** HTML emails, just + from displaying them and thus any security risk can only be mitigated by disabling + showing HTML on the client (or removing the HTML part in the mail server). + +Modifying the look of emails beyond the theming app capabilities +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can now overwrite templates by writing a class that implements the template interface +(or extends it to not need to copy over everything). Easiest way is then put this class into +an app and load it (so you do not need to patch it in on every update). + +This is the interface of the class that needs to be implemented: https://github.com/nextcloud/server/blob/master/lib/public/Mail/IEMailTemplate.php + +That is the implementation that could be extended and used to see how it works: https://github.com/nextcloud/server/blob/master/lib/private/Mail/EMailTemplate.php + +An example from `a GitHub issue `_: + +1. Look at the source code of extended class `OC\Mail\EMailTemplate::class `_ + +2. Then override what you need in your own `OC\Mail\EMailTemplate::class` extension + +**Example:** + +Let's assume that we need to override the email header:: + + + // your theme email header modification + + EOF; + } + +3. Then in ``config/config.php`` change ``mail_template_class`` to your class namespace:: + + 'mail_template_class' => 'OCA\\MyApp\\MyClass', + +You will find a detailed step by step guide in our `support portal `_. Setting mail server parameters in config.php -------------------------------------------- From 9326f1b47fa72ed5baaaab5195520e46c8c90bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Bl=C3=BCm?= Date: Wed, 11 Apr 2018 13:11:29 +0200 Subject: [PATCH 3/3] Update email_configuration.rst --- admin_manual/configuration_server/email_configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin_manual/configuration_server/email_configuration.rst b/admin_manual/configuration_server/email_configuration.rst index 6bd8fd0e4..dbd67cd4e 100644 --- a/admin_manual/configuration_server/email_configuration.rst +++ b/admin_manual/configuration_server/email_configuration.rst @@ -96,7 +96,7 @@ Modifying the look of emails beyond the theming app capabilities You can now overwrite templates by writing a class that implements the template interface (or extends it to not need to copy over everything). Easiest way is then put this class into -an app and load it (so you do not need to patch it in on every update). +an app and load it (so you do not need to patch it on every update). This is the interface of the class that needs to be implemented: https://github.com/nextcloud/server/blob/master/lib/public/Mail/IEMailTemplate.php