I want to use the Groovy scripting feature in the email-ext plugin for Jenkins, but I'm new to this and there seems to be a lot of assumed knowledge. Like how one goes about invoking one of these templates in the first place.
The answer to this is probably quite obvious, but I'm feeling a bit lost and would appreciate being pointed in the right direction.
This example is based on the official email-ext documentation, which unfortunately does not provide any concrete examples on how to use the
$SCRIPT
line of code in Pipeline. If you wish to use an HTML template as the body for your email then you need to:Create a template file called
my-email.template
or whatever you like - you can find some template examples hereHave your Jenkins administrator place the
my-email.template
file inside$JENKINS_HOME\email-templates
directory on Jenkins machine - make sure that user jenkins owns this directory as well as its content (i.e. template files)In Pipeline load
my-email.template
as body content: