一、收件人邮箱简写
Jenkins首页-系统管理-系统设置,Extended E-mail Notification模块下
【Default user E-mail suffix】设置邮箱后缀,例如:@hotmail.com
设置了以后,只需要在salve项目中,【Editable Email Notification】模块【Project Recipient List】中输入前缀就可以了,例如:best.fei a.b
这样就可以给 best.fei@hotmail.com 和a.b@hotmail.com发邮件了
二、邮件报告模版
Jenkins首页-系统管理-系统设置,Extended E-mail Notification模块下
【Default Subject】设置:
$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
【Default Content】设置
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>${ENV, var="JOB_NAME"}-第${BUILD_NUMBER}次构建日志</title>
</head>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
}
body {
width: 800px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif;
font-size: 14px;
color: #1F2D3D;
padding: 10px;
}
h1,
h2 {
padding: 10px 0;
}
h1 {
color: #0000E3;
}
h2 {
margin-top: 20px;
}
table {
background: #f5f5f5;
border-collapse: collapse;
box-shadow: inset 0 1px 0 #fff;
font-size: 12px;
line-height: 24px;
text-align: left;
}
th {
background: linear-gradient(#777, #444);
border-left: 1px solid #555;
border-right: 1px solid #777;
border-top: 1px solid #555;
border-bottom: 1px solid #333;
box-shadow: inset 0 1px 0 #999;
color: #fff;
font-weight: bold;
padding: 10px 15px;
position: relative;
text-shadow: 0 1px 0 #000;
}
th:after {
background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, .08));
content: '';
display: block;
height: 25%;
left: 0;
margin: 1px 0 0 0;
position: absolute;
top: 25%;
width: 100%;
}
th:first-child {
border-left: 1px solid #777;
box-shadow: inset 1px 1px 0 #999;
}
th:last-child {
box-shadow: inset -1px 1px 0 #999;
}
td {
border-right: 1px solid #fff;
border-left: 1px solid #e8e8e8;
border-top: 1px solid #fff;
border-bottom: 1px solid #e8e8e8;
padding: 10px 15px;
position: relative;
transition: all 300ms;
}
td:first-child {
box-shadow: inset 1px 0 0 #fff;
}
td:last-child {
border-right: 1px solid #e8e8e8;
box-shadow: inset -1px 0 0 #fff;
}
tr:last-of-type td {
box-shadow: inset 0 -1px 0 #fff;
}
tr:last-of-type td:first-child {
box-shadow: inset 1px -1px 0 #fff;
}
tr:last-of-type td:last-child {
box-shadow: inset -1px -1px 0 #fff;
}
li {
list-style: none;
padding: 6px 0;
}
li > span {
margin-right: 6px;
}
li > a {
color: #58B7FF;
}
.tip {
color: #bbb;
padding: 10px 0;
}
.failed {
color: #FF4949;
}
.passed {
color: #13CE66;
}
</style>
<body>
<h1>测试结果 - ${BUILD_STATUS}</h1>
<span class="tip">(本邮件是程序自动下发的,请勿回复,谢谢!!)</span>
<h2>Soapui Test Summary:</h2>
<table>
<thead>
<tr>
<th></th>
<th>Total</th>
<th>Failed</th>
<th>Passed</th>
</tr>
</thead>
<tbody>
<tr>
<td>Critical tests</td>
<td>${TEST_COUNTS}</td>
<td class="failed">${TEST_COUNTS,var="fail"}</td>
<td class="passed">${TEST_COUNTS,var="pass"}</td>
</tr>
<tr>
<td>All tests</td>
<td>${TEST_COUNTS}</td>
<td class="failed">${TEST_COUNTS,var="fail"}</td>
<td class="passed">${TEST_COUNTS,var="pass"}</td>
</tr>
</tbody>
</table>
<br>
<h2>Failed Cases:</h2>
<p class="failed">${FAILED_TESTS}</p>
<br><br>
<h2>Build Info:</h2>
<ul>
<li><span>项目名称:</span>${JOB_NAME}</li>
<li><span>构建编号:</span>${BUILD_NUMBER}</li>
<li><span>构建结果:</span><a href="${BUILD_URL}">Check build results </a></li>
<li><span>测试报告:</span><a href="${BUILD_URL}/testReport">Browse Test Report</a></li>
<li><span>测试日志:</span><a href="${BUILD_URL}/console">Open Test Log</a></li>
<li><span>构建变更:</span>${CHANGES_SINCE_LAST_SUCCESS}</li>
</ul>
</body>
</html>
设置了以后,只需要在salve项目中,【Editable Email Notification】模块,
【Default Subject】项配置:$DEFAULT_SUBJECT
【Default Content】项配置:$DEFAULT_CONTENT
三、配置完成后触发邮件,得到的邮件样式如下: