Jenkins Send e-mail

background

How to send Jenkins to build after build status to the specified mailbox?

achieve

First of all, Jenkins to install pluginsEmail Extension Plugin

After the installation is complete, enter 系统管理-> 系统设置begin setting!

Jenkins Location

Set Jenkins Localtion: 

  • The URL of Jenkins : Jenkins Address
  • Admin email address System : the sender's email

Extended E-mail Notification

Here send messages related configuration setting, such as sending SMTP server and types.

First, click on the AdvancedShow Advanced Configuration:  Then fill in the required fields: 

  • Server the SMTP : the SMTP server address
  • The User E-mail suffix the Default : default mailbox prefix
  • The Name the User : Sender E-mail
  • Password : E-mail sender  POP3/STMP authorization code (unreal password)
  • Port the SMTP : the SMTP server SSL port
  • Content Type the Default : the default content type
  • Recipients the Default : the default recipient

Configuration is completed save point

In application engineering

Create a new Jenkins Project, other operations like in the past, can be attached to e-mail sending function:   After opening, the default option is to use a lot of items, that is the option we configured in the system settings, on the basis of our own needs changes you can: 

Additional

一个不错的Default Content模板:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>${ENV, var="JOB_NAME"}-第${BUILD_NUMBER}次构建日志</title>
</head>

<body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4"
    offset="0">
    <table width="95%" cellpadding="0" cellspacing="0"
        style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
        <tr>
            <td><br />
            <b><font color="#0B610B">构建信息</font></b>
            <hr size="2" width="100%" align="center" /></td>
        </tr>
        <tr>
            <td>
                <ul>
                    <li>项目名称 : ${PROJECT_NAME}</li>
                    <li>构建编号 : 第${BUILD_NUMBER}次构建</li>
                    <li>SVN 版本: ${SVN_REVISION}</li>
                    <li>触发原因: ${CAUSE}</li>
                    <li>构建日志: <a href="${BUILD_URL}console">${BUILD_URL}console</a></li>
                    <li>构建  Url : <a href="${BUILD_URL}">${BUILD_URL}</a></li>
                    <li>工作目录 : <a href="${PROJECT_URL}ws">${PROJECT_URL}ws</a></li>
                    <li>项目  Url : <a href="${PROJECT_URL}">${PROJECT_URL}</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td><b><font color="#0B610B">变更集</font></b>
            <hr size="2" width="100%" align="center" /></td>
        </tr>

        <tr>
            <td>${JELLY_SCRIPT,template="html"}<br/>
            <hr size="2" width="100%" align="center" /></td>
        </tr>


    </table>
</body>
</html>

Guess you like

Origin blog.csdn.net/hbhaozong/article/details/93736088