Jenkins email template
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>${ENV, var="JOB_NAME"} - Build ${BUILD_NUMBER}</title> <style> body { display: flex; justify-content: center; align-items: center; } .header { color: #060f8c } .row-td { color: #409EFF; font-weight: bolder; margin-top: 10px; } .label-style { margin: 0px 0px 5px 20px; } .label-style { color: #333; font-weight: bold } </style> </head> <body> <div style="width: 800px"> <table width="95%" cellpadding="0" cellspacing="0" style="font-size: 11pt; font-family:Calibri, Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Arial,sans-serif"> <tr> <td>(The email is sent automatically by PB Monitor Team, Please do not apply)</td> </tr> <tr> <td > <h2 class ="header"> Build Status - ${BUILD_STATUS} </h2> </td> </tr> <tr> <td > <div class="row-td">Build Info</div> <hr size="2" width="100%"> </td> </tr> <tr> <td> <div> <lable class="label-style">Project: </lable>${PROJECT_NAME} </div> <div> <lable class="label-style">Build Log: </lable> <a href="${BUILD_URL}console">${BUILD_URL}console</a> </div> <div> <lable class="label-style">Build URL: </lable> <a href="${BUILD_URL}">${BUILD_URL}</a> </div> <div> <lable class="label-style">Project URL: </lable> <a href="${PROJECT_URL}">${PROJECT_URL}</a> </div> </td> </tr> <tr> <td> <div class="row-td"> Changes Since Last Successful Build </div> <hr size="2" width="100%" align="center"> </td> </tr> <tr> <td> <div> <lable class="label-style">Change History: </lable> <a href="${PROJECT_URL}changes">${PROJECT_URL}changes</a></li> </div> <div> ${CHANGES_SINCE_LAST_SUCCESS,reverse=true, format="Changes for Build #%n:<br>%c<br>",showPaths=true,changesFormat="<pre>[%a]<br>%m</pre>",pathFormat=" %p"} </div> </td> </tr> <tr> <td> <div class="row-td">Failed Test Results</div> <hr size="2" width="100%" align="center"> </td> </tr> <tr> <td> <pre style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">$FAILED_TESTS</pre> <br> </td> </tr> <tr> <td> <div class="row-td">Build Log (Last 100 rows)</div> <hr size="2" width="100%" align="center"> </td> </tr> <tr> <td> <div style="width: 700px">${BUILD_LOG, maxLines=100}</div> </td> </tr> </table> </div> </body> </html>
Just make sure Content Type is set to HTML and add the following to the body:
${FILE,path="my.html"}
This will place the my.html content in your email body (location of file is relative to job's workspace. I use it and it works well.
I hope this helps.
EDIT: Note that you must have the Jenkins version 1.532.1 (or higher) to support this feature with the email-ext plugin.

浙公网安备 33010602011771号