Get A List of Email Templates Programmatically

Would you like to get a list of the email templates programmatically that exist in Magento 2, meaning custom email templates and default. Let's see how you can do that.

For our example we have created a helper class as you can see below with two functions, the getCustomTemplates and the getConfigTemplates . The getCustomTemplates function returns a collection of all custom templates created in backend and the getConfigTemplates function return a list of all email templates, both default module and theme-specific templates.

The full example as extension can be found here.

Feel free to share this post and ask your questions in the comments below.

Till next time!