nextcloud/templateeditor

Name: templateeditor

Owner: Nextcloud

Description: ? Mail template editor - Nextcloud 11 and older

Created: 2016-07-20 22:58:09.0

Updated: 2018-04-12 14:44:45.0

Pushed: 2018-04-12 14:44:44.0

Homepage:

Size: 295

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Template editor

? Mail template editor

The template editor is only compatible with Nextcloud 11 or older.

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.

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 nextcloud/templateeditor#23:

  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.

p

space \OCA\MyApp;

OC\Mail\EMailTemplate;

s MyClass extends EMailTemplate

protected $header = <<<EOF 
    <table align="center" class="wrapper">
        // your theme email header modification
    </table>
EOF;

  1. Then in config/config.php change mail_template_class to your class namespace
l_template_class' => 'OCA\\MyApp\\MyClass',

If you need any help, contact the Nextcloud support team or read a step by step guide in the support portal.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.