Read App Setting in EMailTemplate

Hi all,

i have write a App to change the E-Mail Template.

I write also a setting Page in admin to store some stuff. Now i have no idea to get the app config in the EMailTemplate class. >Can someone give me a hint?

Here the Class:

use OC\Mail\EMailTemplate as ParentTemplate;
class EMailTemplate extends ParentTemplate {

Thank you for help

Hi again, sorry … the Support section was wrong, I Update now.

Hello Again,

i have now finde a way:

it seems to work, ist this ok to use it? Or is there a better way?


It’s rather discouraged. Use dependency injection and OOP code if possible, like having IConfig injected into your template subclass.

Hi @ChristophWurst,

thanks for the answer. I am not very good developer. Can you help me?

I habe try it already an add:

use OCP\IConfig;

But how use it in my Class?

use OC\Mail\EMailTemplate as OriginalTemplate;
class EMailTemplate extends OriginalTemplate {

I have try to overite the constructor, but the Original EMailTemplate have no config pass…


Have your own constructor and add the IConfig as argument. You can find more info at