Html output for mail body is rendering in webui

I have Html output which includes multiple tables. When I use the html output directly in the email body template it works fine but when loads from {{. Check. Output }} then the Html output does not get parsed into proper tabular format, rather it outputs the whole html output.

Not sure if any extra character is getting added while loading the output in the template

Hi there, @Rehan_Ch :wave: can you share your check configuration, and any details about the plugin(s) you’re using?

To export the check configuration, run this command and then share the output here:

$ sensuctl check info <check_name> --format yaml 

NOTE: this is probably obviously, but you’ll need to replace <check_name> with the name of the check in question.

I am using email handler plugin and installed using below command.

sensuctl asset add sensu/sensu-email-handler -r email-handler

below is the check definition
{
“api_version”:“core/v2”,
“type”:“Check”,
“metadata”:{
“namespace”:“default”,
“name”:“app-gw-health-check”,
“labels”:{}
},
“spec”:{
“command”:“python3.6 /etc/sensu/plugins/app-gw-health-check.py”,
“subscriptions”:[
“roundrobin:worker”
],
“publish”:true,
“round_robin”:true,
“interval”:3600,
“handlers”:[
“alert_handler”,
“resolve_handler”
],
“proxy_entity_name”:“proxyclient”,
“timeout”:590
}
}

Script Output in HTML format:

<table class="tg">
<tbody>
<tr>
<th>#</th>
<th>Instance Name</th>
<th>Status</th>
</tr>
<tr>
<td>1</td>
<td>engg_ss_-1</td>
<td>Unhealthy</td>
</tr>
</tbody>
</table>
<table class="tg">
<tbody>
<tr>
<th>#</th>
<th>Instance Name</th>
<th>Status</th>
</tr>
<tr>
<td>1</td>
<td>engg-ss_0</td>
<td>Unhealthy</td>
</tr>
</tbody>
</table>

Handler template:


.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:13px;padding:7px 5px;border-style:solid;border-
width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg th{font-family:Arial, sans-serif;font-size:13px;font-weight:normal;padding:7px
5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-
color:black;}
.tg .tg-ydru{font-family:Arial, Geneva, sans-serif !important;;background-
color:#efefef;border-color:#9b9b9b;vertical-align:top}
.tg .tg-greenbg{font-family:Arial, Geneva, sans-serif !important;;background-
color:#a4ff48;border-color:#9b9b9b;vertical-align:top}
.tg .tg-amberbg{font-family:Arial, Geneva, sans-serif !important;;background-
color:#e5b73b;border-color:#9b9b9b;vertical-align:top}
.tg .tg-redbg{font-family:Arial, Geneva, sans-serif !important;;background-color:
#ff6347;border-color:#9b9b9b;vertical-align:top}
.tg .tg-rb8b{background-color:#efefef;border-color:#9b9b9b;vertical-align:top}
.verinfo {color:Gray;font-family:Arial, sans-serif;font-size:9px}

<table class="tg">
    <tr>
        <td class="tg-ydru">Check Name</td>
        <td class="tg-ydru">{{ .Check.Name }}</td>
    </tr>
    <tr>
        <td class="tg-ydru">Check Status</td>
        <td class="tg-redbg">CRITICAL</td>
    </tr>
    <tr>
        <td class="tg-ydru">Check Output</td>
        <td class="tg-ydru">{{ .Check.Output }}</td>
    </tr>
    <tr>
        <td class="tg-ydru">Timestamp</td>
        <td class="tg-ydru">{{(UnixTime .Check.Executed)}}</td>
    </tr>
</table>

Output:
Check Output is not getting formatted.
image

At the same time if I manually paste the output into the template then it works fine. Not sure if any extra character is getting added when loading into the template using {{.Check.Output}}

The same HTML Output appears on Web UI but as per me Web UI should show output after formatting the html

Please let me know, if you need more details.