I once worked on a project that generated HTML email. We found it easiest to run an internal web server and do an HTTP request to get the content and add the resulting HTML as a MIME part.
I’m trying MJML on a Django 3.1.3 site at the moment. I installed django-mjml and installed mjml in the root of my project with npm.
I experienced an error message when running the development server:
django.core.exceptions.ImproperlyConfigured: Problem to run command "mjml -i -s"
[Errno 2] No such file or directory: 'mjml'
Check that mjml is installed and allow permissions for execute.
See https://github.com/mjmlio/mjml#installation
I think the problem was that I didn’t have mjml installed globally. (I temporarily installed it globally to check.) It seems like the program would require npx mjml to find it in the local node_modules directory.
After looking more closely at the docs, I fixed it by adding this to settings.py:
MJML_EXEC_CMD = './node_modules/.bin/mjml'
I’m adding this comment here in case it can help someone who is searching in Google for that error message.