I like to commit my Jenkins email script to my working copy and use it with Email-ext.
So I wrote something like :
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
post {
always {
echo 'Sending email...'
emailext body: '''${SCRIPT, template="${WORKSPACE}\\Src\\Scripts\\Jenkins\\groovy-html2.template"}''',
mimeType: 'text/html',
subject: "[Leeroy Jenkins] ${currentBuild.fullDisplayName}",
to: "[email protected]",
replyTo: "[email protected]",
recipientProviders: [[$class: 'CulpritsRecipientProvider']]
}
}
}
But I get the following mail: Groovy Template file [${WORKSPACE}SrcScriptsJenkinsgroovy-html2.template] was not found in $JENKINS_HOME/email-templates.