Hello folks, is there any solution to add a line break to the custom email notifications template ?
I have the following template:
{{ define "test_tmpl" }}
{{ if gt (len .Alerts.Firing) 0 }}
FIRING : {{ range .Alerts.Firing }}
{{ if gt (len .Annotations) 0 }}
SUMMARY: {{ .Annotations.summary }}
DESCR: {{ .Annotations.description }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
and I would to add a newline after FIRING and SUMMARY strings. I tried to print a newline character using a Go ‘print’ also html tags and many variants of \n, any attempt doesn’t work. It just print these characters as a plain text, in case with {{print “\n” }} there is no newlines and this command doesn’t print into email as others.
I use Grafana 8.5.5.
We’ve also found that different email clients can handle whitespace differently. There is a discussion of that here. The fix in 52253 looks like it incorporates the pre line strategy.
@jjain1 are you using outlook as your email client? There is a comment at the end of the PR:
Outlook does not support white-space: pre-line introduced in the PR. We did not know that Outlook and some other mail clients do not support this CSS property.