diff --git a/pkg/email/templates/DEVELOPMENT.md b/pkg/email/templates/DEVELOPMENT.md
index 5d74830434..17f24363ea 100644
--- a/pkg/email/templates/DEVELOPMENT.md
+++ b/pkg/email/templates/DEVELOPMENT.md
@@ -16,6 +16,8 @@ Each of these email templates gets rendered together with the base template that
We use [MJML](https://mjml.io/) to generate the HTML base template `base.html.tmpl` from `base.mjml`. Do not edit `base.html.tmpl` directly. If you want to edit the HTML base template, edit the `.mjml` files and run `go generate ./pkg/email/templates` to update `base.html.tmpl`.
+`base.mjml` composes the repo-local partials `_attributes.mjml`, `_header.mjml` and `_footer.mjml` via `mj-include`. MJML v5+ disables `mj-include` by default, so `generate.sh` passes `--config.allowIncludes true`. This is safe here because the included files are trusted and committed to this repository.
+
The HTML base template contains three blocks: **title**, **preview** and **body**. The **title** is typically not visible in emails, but would be visible if we start supporting "view this email online" functionality. The **preview** is a short text that many email clients render in the list view, next to the subject.
## Testing
diff --git a/pkg/email/templates/base.html.tmpl b/pkg/email/templates/base.html.tmpl
index 71cb95c41c..a187be261e 100644
--- a/pkg/email/templates/base.html.tmpl
+++ b/pkg/email/templates/base.html.tmpl
@@ -40,7 +40,6 @@
display: block;
margin: 13px 0;
}
-
{{ block "preview" . }}{{ end }}
-
+
diff --git a/pkg/email/templates/generate.sh b/pkg/email/templates/generate.sh
index fe11f446c6..1fa6695451 100755
--- a/pkg/email/templates/generate.sh
+++ b/pkg/email/templates/generate.sh
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
+# MJML v5+ disables mj-include by default; our base template composes trusted,
+# repo-local partials (_attributes/_header/_footer), so includes are enabled here.
for template in $(find . -name '*.mjml' -not -name '_*.mjml')
do
- yarn run mjml $PWD/$template -o $PWD/${template%.mjml}.html.tmpl
+ yarn run mjml --config.allowIncludes true $PWD/$template -o $PWD/${template%.mjml}.html.tmpl
+ # mjml v5 omits the trailing newline; append one to keep a POSIX-clean file.
+ printf '\n' >> $PWD/${template%.mjml}.html.tmpl
done
diff --git a/pkg/email/templates/testdata/api_key_changed.body.golden.html b/pkg/email/templates/testdata/api_key_changed.body.golden.html
index 31ef9b05d9..58858cbc9d 100644
--- a/pkg/email/templates/testdata/api_key_changed.body.golden.html
+++ b/pkg/email/templates/testdata/api_key_changed.body.golden.html
@@ -40,7 +40,6 @@
display: block;
margin: 13px 0;
}
-
@@ -48,7 +47,6 @@
An API key of your application "foo-app" has been changed.