Jenkins 配置郵件發送

Jenkins 配置郵件發送

  1. 登錄之後點擊,系統設置:

這裏寫圖片描述

2.系統管理員的郵箱要和發送郵件的郵箱保持一致:

這裏寫圖片描述

3.系統默認郵箱配置(點擊高級之後纔可以看到所有配置):

這裏寫圖片描述

4.驗證郵箱配置(填寫一個可以郵件的郵箱,點擊 Test Configuration)
如果配置正確你[email protected] 郵箱就會收到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>
發佈了80 篇原創文章 · 獲贊 38 · 訪問量 29萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章