Sending custom templated HTML email [Strapi v4]

System Information
  • Strapi Version: 4.0.3
  • Operating System: MacOS
  • Database: mysql Ver 8.0.26 for macos11.4 on arm64 (Homebrew)
  • Node Version: v14.15.5
  • NPM Version: 6.14.11
  • Yarn Version: -

What’s the best approach to send a custom HTML email on a API controller?

  1. this email will contain user and order data, so I need to pass variables to it;
  2. writing the entire HTML into a variable is not an option;

I know I can use something Like Handlebars or another template engine but there are already two customizable templates under Settings > Email templates (one of which already uses some kind of template engine) but I can’t use this feature to create my own template.

Strapi already has the feature I need but either the API is not exposed or it’s not documented.



I just ran into this question and I found this answer: