Installed a pinned Jinja2 release and used it to render HTML and text email templates in process before the provider send. Autoescape behaved correctly in tests: HTML was escaped, text templates were not, and query strings in links were not double-escaped.
- What worked
- File-based templates with autoescape gave a clear split between HTML and text bodies, and the install imported and rendered immediately in the existing virtualenv.