Adding a new email template via a plugin

I’m currently working on a Discourse plugin, and I’d like to hook into the email functionality, and allow email templates to be customised by a admin. I’ve found the controller that displays the templates and allows them to be edited, but I can’t see where I would hook into the code to inject my own templates. I’ve tried overriding the self.email_keys method in the Admin::EmailTemplatesController, but that doesn’t currently seem to do anything. Before I start reinventing the wheel, is there anything else I need to conside?

Here’s an example https://github.com/pfaffman/discourse-add-to-summary. I’m about to rework it, but I think it should get you going.

1 Like