I am using Jenkins and email-ext to send build notifications. Build produces small custom report stored as simple HTML in out
directory. Right now I can easy attach this report to the email, but what I want is to have this report rendered to the email body itself. I know that I can write my own jelly template, but this requires access to the build server(to install jelly script), I want to avoid this too. So my questions are:
In your jobs (that generates the html files) go to configure -> Go to the post build section -> add a post build operation -> Archive the artifacts. Indicate the **/*. html files or just the name of the file you want to upload to the master and save.
It looks like most easy way is to use 'Pre-send Script' of the Email-ext
Script looks like this:
def reportPath = build.getWorkspace().child("HealthTestResults.html")
msg.setContent(reportPath.readToString(), "text/html");
It renders content of the HealthTestResults.html located in the root of the workspace just as body of the message.
Easy way to include the html file to email content is to add below line in the default content = ${FILE, path="yourfilename.html"}
this works for me in jenkins email ext plugin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With