Jenkins 配置邮件发送

Jenkins 配置邮件发送

  1. 登录之后点击,系统设置:

这里写图片描述

2.系统管理员的邮箱要和发送邮件的邮箱保持一致:

这里写图片描述

3.系统默认邮箱配置(点击高级之后才可以看到所有配置):

这里写图片描述

4.验证邮箱配置(填写一个可以邮件的邮箱,点击 Test Configuration)
如果配置正确你test@163.com 邮箱就会收到jenkins 测试邮件

这里写图片描述

  1. 我们再配置一下jenkins 邮件扩展插件的配置,同样点击高级之后才能展示所有选项:
    和默认邮箱的配置基本差不多,不过这个可以编辑邮件的内容。
    你的邮件内容格式可以定义在 Default Content 里面。

这里写图片描述

最后是在你的job 中配置邮件信息,和触发条件:
添加构建后操作->Editable Email Notification
填写: Project Recipient List, 不会写,就点一下帮助文档
Content Type 选择:html(text/html)
其他的默认就行了
最后点击 Advanced Settings->Add Trigger->
选择邮件发送的触发类型

最后附上我自己配置的一个邮件模板:

<!-- #######  YAY, I AM THE SOURCE EDITOR! #########-->

<body>

    <head>
        <STYLE TYPE="text/css">
            BODY {
                background-image: URL(http://pic1.win4000.com/wallpaper/2/57887791aba6b.jpg);
                background-position: center;
                background-repeat: no-repeat;
                background-attachment: fixed;
                background-size:100% 100%;
            }
        </STYLE>
    </head>
    <h2 style="color: #5e9ca0; text-align: center;">PS:(本邮件是自动化测试邮件,请勿回复!)</h2>
    <table class="editorDemoTable" style="height: 273px;" width="430">
        <thead>
            <tr>
                <td nowrap="nowrap" style="background-color: #3498db; text-align: center;" colspan="2">
                    <h2><span style="color: #000000;">自动化测试报告</span></h2>
                </td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">项目名称:</span></td>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">$PROJECT_NAME</span></td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">构建编号:</span></td>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">$BUILD_NUMBER</span></td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">构建状态:</span></td>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">$BUILD_STATUS</span></td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">触发原因:</span></td>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">${CAUSE}</span></td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">构建日志地址:</span></td>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #00ccff;">&nbsp;<a style="color: #00ccff;" title="构建日志" href="${BUILD_URL}console">${BUILD_URL}console</a></span></td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">构建地址:</span></td>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #00ccff;">&nbsp;<a style="color: #00ccff;" title="构建地址" href="$BUILD_URL">$BUILD_URL</a></span></td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">测试报告地址:</span></td>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #00ccff;"><a style="color: #00ccff;" title="测试报告地址" href="${BUILD_URL}robot/report/report.html">${BUILD_URL}robot/report/report.html</a></span></td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #808000;">测试日志地址:</span></td>
                <td nowrap="nowrap" style="border-color: gray;"><span style="color: #00ccff;">&nbsp;<a style="color: #00ccff;" title="测试日志地址" href="${BUILD_URL}robot/report/log.html">${BUILD_URL}robot/report/log.html</a></span></td>
            </tr>
        </tbody>
    </table>
</body>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值