At first I had problem with security and the environment injection from template files.
But now it doesn't complain (nothing into the jenkins.err.log), but the email is not received (the test email go through and get received into Jenkins config, so the smtp settings is right).
<!-- Custom Variables -->
<%
import hudson.model.*
def style_cie_color = "#77278B"
def pa = new ParametersAction(
[
new StringParameterValue("EMAIL_CIE_COLOR", style_cie_color),
new StringParameterValue("EMAIL_CIE_LOGO", cie_logo)
])
def build = Thread.currentThread().executable
build.addAction(pa)
%>
<%
import hudson.Util
import hudson.Functions
import hudson.model.Result;
import hudson.matrix.MatrixBuild
import hudson.matrix.MatrixRun
import hudson.matrix.MatrixConfiguration
import hudson.matrix.MatrixProject
import hudson.matrix.Combination
%>
<!-- Extract previous template Variables -->
<%
def env = build.environment
style_cie_color = env.EMAIL_CIE_COLOR
cie_logo = env.EMAIL_CIE_LOGO
%>
<!-- Local variables -->
<%
style_default = "font-family:Verdana,Helvetica,sans serif; font-size:11px; color:black;"
style_header = "color: black;"
style_bg1 = "color:white; background-color:" + style_cie_color + "; font-size:120%;"
style_bg2 = "color:#666666; background-color:white; font-size:110%; margin-left: 2px; margin-right: 2px;"
style_bg3 = "color: black; background-color:white;"
style_tr = "border: 1px solid " + style_cie_color + ";"
style_failure = "color: red;"
style_success = "color: green;"
style_unstable = "color: yellow;"
style_console = "font-family:Courier New;"
if(build.result == Result.SUCCESS)
{
result_img += "success.small.png"
build_style = style_success;
}
else if (build.result == Result.FAILURE)
{
result_img += "error.small.png"
build_style = style_failure;
}
else
{
result_img += "warning.small.png"
build_style = style_unstable;
}
%>
<BODY style="${style_default}">
<!-- Main info -->
<TABLE>
<TR>
<TD valign="right"><IMG SRC="${cie_logo}" /></TD>
</TR>
<TR>
<TD align="right"><IMG SRC="${result_img}" /></TD>
<TD valign="center"><B style="font-size: 200%;">BUILD ${build.result}</B></TD>
</TR>
<TR>
<TD>Build URL</TD>
<TD><A href="${rooturl}${build.url}">${rooturl}${build.url}</A></TD>
</TR>
<TR>
<TD>Project:</TD>
<TR>
<TD>Date of build:</TD>
<TD>${it.timestampString}</TD>
</TR>
<TR>
<TD>Build duration:</TD>
<TD>${build.durationString}</TD>
</TR>
</TABLE>
<BR/>
<!-- ... -->
</BODY>