I. Installation of mailbox plug-in

1. Install the Email Extension Plugin

Select optional plugins in Jenkins Plug-in Management, search Email Extension Plugin, and click Install

Second, system configuration

1. Obtain the authorization code of the mailbox

  • 163 How to obtain the Email address

    1. After logging in to your email, click POP3/SMTP/IMAP in Settings

    2. Enable the SMTP service and add the authorization code

      After clicking the add authorization code, it will prompt you to send a verification SMS message with your mobile phone number. After the verification is successful, an authorization code will be generated. Copy this authorization code, which will be used in Jenkins Settings later

  • How to obtain QQ mailbox

    1. Click Settings = > account, find the POP3 / IMAP/SMTP/Exchange/CardDAV/CalDAV service

      To enable the SMTP service, clickGenerating authorization Code

    2. Obtaining authorization Code

      After clicking to generate an authorization code, you need to send an authentication message to generate an authorization code after the authentication is successful, just like netease Email

2. System Settings

  • Configuring the Administrator’s Mailbox

    Go to Jenkins Location in system Settings and configure the administrator email

  • Setting Sender Information

    Locate the Extended E-mail Notification Settings item in system Settings and configure basic information

    The important thing to note here is that be sure to click advanced to configure the user password as shown below

  • Configuring triggers

    Check Always and Success

  • Configuring Email Notification

    Locate the email notification Settings in system Settings and configure the email notification information:

    After completing the configuration, we click send test Email to test the configuration. If we can receive Jenkins’ email successfully, the configuration will be successful.

3. Mail sending configuration within the project

1, addEditable Email Notificationoperation

On the project configuration page, select post-build operations and add Editable Email Notification

2. Configure related information

Basically keep the default Settings

Click Advanced Settings to configure triggers and receive email notifications to users

Click ADD TGIGGER to ADD an Always trigger and select which users to send it to

Now that the basic setup is complete, click Save to build your project and give it a try

4. Email notification template

1. HTML format template

<! DOCTYPEhtml>    
<html>    
<head>    
<meta charset="UTF-8">    
<title>${ENV, var="JOB_NAME"}- ${BUILD_NUMBER} time build log</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>This email is automatically sent by the system, no need to reply!<br/>${PROJECT_NAME} Project build information</br> 
            <td><font color="#CC0000">${BUILD_STATUS}</font></td>   
        </tr>    
        <tr>    
            <td><br />    
            <b><font color="#0B610B">Build information</font></b>    
            <hr size="2" width="100%" align="center" /></td>    
        </tr>    
        <tr>    
            <td>    
                <ul>    
                    <li>Project name: ${PROJECT_NAME}</li>    
                    <li>Build number: the ${BUILD_NUMBER} build</li>    
                    <li>${CAUSE}</li>    
                    <li>Build status: ${BUILD_STATUS}</li>    
                    <li>Build log:<a href="${BUILD_URL}console">${BUILD_URL}console</a></li>    
                    <li>Build the Url:<a href="${BUILD_URL}">${BUILD_URL}</a></li>    
                    <li>Working Directory:<a href="${PROJECT_URL}ws">${PROJECT_URL}ws</a></li>    
                    <li>The Url of the project:<a href="${PROJECT_URL}">${PROJECT_URL}</a></li>    
                </ul>    

<h4><font color="#0B610B">Failure case</font></h4>
<hr size="2" width="100%" />
$FAILED_TESTS<br/>

<h4><font color="#0B610B">Recently submitted (#$SVN_REVISION)</font></h4>
<hr size="2" width="100%" />
<ul>
${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="%c", changesFormat="<li>%d [%a] %m</li>"}
</ul>Detailed submission:<a href="${PROJECT_URL}changes">${PROJECT_URL}changes</a><br/>

            </td>    
        </tr>    
    </table>    
</body>    
</html>
Copy the code
  • This template looks like this: