Email templates in plugin

It is possible to register email templates in plugin?

I would like to use code like this

  'template' => 'media',
  'data' => [
    'name' => 'Peter',
    'text' => 'welcome to our wonderful email list'

just like in email guide section “HTML & Plain Text”

How can I register ‘media’ template so that email method refers to ‘media.html.php’ & ‘media.text.php’??

Thanks in advance

Should work just like other template extension, with the only difference that you need to register them with 'emails/media' => ....

'emails/media' => ???

how do i refer to “two” files?

Forgot the link: Templates | Kirby CMS

Thanks for your prompt reply!
I had already read the documentation. What I don’t understand is how to indicate the automatic reference to the ‘html’ and ‘txt’ version of the template.
If I use guide syntax I have to refer to a specific file:

'media' => __DIR__ . '/emails/media.php'

In the example that is given in the guide section “HTML & Plain Text” $kirby->email(['template' => 'media',... has the ability to refer to “two” files emails/media.html.php & emails/media.txt.php

How can I get the same result?

1 Like

thank you!