I want to send the cppcheck report through email but I had never used the email ext plugin before, so I found this
https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin with a nice jelly template to do so, I have also followed the steps in the documentation, to send my own templates in a pipeline job, I have created my template with a .jelly extension and set it into my ```$JENKINS_HOME\email-templates``` although the email-templates folder did not exist, so I am not sure if it should be created beforehand just by installing the plugin or what I am missing. This is my stage
```
stage('Mail cppcheck report') {
steps{
script{
def jobName = currentBuild.fullDisplayName
emailext body: '''${JELLY_SCRIPT, template="custom"}''',
subject: "[Jenkins] ${jobName}",
to: "${mailRecipients}"
}
}
}
```
And this is the template I want to use but I keep getting the following error ``` JellyException: Could not parse Jelly script : null```
```
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
<html>
<j:set var="cppcheckAction" value="${it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')}" />
<j:if test="${cppcheckAction!=null}">
<j:set var="cppcheckResult" value="${cppcheckAction.getResult()}" />
<j:if test="${cppcheckResult!=null}">
<h2>Summary</h2>
<style type="text/css">
#cppcheckStatistics { width: auto; }
#cppcheckStatistics .number { text-align: right; }
</style>
<table class="pane sortable" id="cppcheckStatistics">
<thead>
<tr>
<td class="pane-header">Severity</td>
<td class="pane-header">Count</td>
<td class="pane-header">Delta</td>
</tr>
</thead>
<tbody>
<tr>
<td class="pane">Error</td>
<td class="pane number">${cppcheckResult.statistics.getNumberErrorSeverity()}</td>
<td class="pane number">${cppcheckResult.getDiff().getNumberErrorSeverity()}</td>
</tr>
<tr>
<td class="pane">Warning</td>
<td class="pane number">${cppcheckResult.statistics.getNumberWarningSeverity()}</td>
<td class="pane number">${cppcheckResult.getDiff().getNumberWarningSeverity()}</td>
</tr>
<tr>
<td class="pane">Style</td>
<td class="pane number">${cppcheckResult.statistics.getNumberStyleSeverity()}</td>
<td class="pane number">${cppcheckResult.getDiff().getNumberStyleSeverity()}</td>
</tr>
<tr>
<td class="pane">Performance</td>
<td class="pane number">${cppcheckResult.statistics.getNumberPerformanceSeverity()}</td>
<td class="pane number">${cppcheckResult.getDiff().getNumberPerformanceSeverity()}</td>
</tr>
<tr>
<td class="pane">Portability</td>
<td class="pane number">${cppcheckResult.statistics.getNumberPortabilitySeverity()}</td>
<td class="pane number">${cppcheckResult.getDiff().getNumberPortabilitySeverity()}</td>
</tr>
<tr>
<td class="pane">Information</td>
<td class="pane number">${cppcheckResult.statistics.getNumberInformationSeverity()}</td>
<td class="pane number">${cppcheckResult.getDiff().getNumberInformationSeverity()}</td>
</tr>
<tr>
<td class="pane">No category</td>
<td class="pane number">${cppcheckResult.statistics.getNumberNoCategorySeverity()}</td>
<td class="pane number">${cppcheckResult.getDiff().getNumberNoCategorySeverity()}</td>
</tr>
</tbody>
<tfoot>
<tr class="sortbottom">
<td class="pane-header">Total</td>
<td class="pane-header number"><B><a href="${rooturl}${build.url}cppcheckResult">${cppcheckResult.report.getNumberTotal()}</a></B></td>
<td class="pane-header number"><B><a href="${rooturl}${build.url}cppcheckResult/source.all/?before=5&after=5&states=new">${cppcheckResult.getDiff().getNumberTotal()}</a></B></td>
</tr>
</tfoot>
</table>
</j:if>
</j:if>
</html>
</j:jelly>
```