jenkins--application--plug-in using--extended e-mail Notification Plugin

Source: Internet
Author: User
Tags html tags

This article is part of the Jenkins Application system article, most of which comes from work and learning practices, some of which are from official documents and netizens ' articles, which are quoted in the "References" section with original links, such as inadvertent infringement of your rights, please contact qq:46106962, If you need further communication please join QQ Group: (Jenkins Learning Communication) 469536515. Reprint and use please indicate the source.PrefaceEmail alerts are a common feature in the use of Jenkins, and Jenkins installs the Mailer plugin plugin for this functionality by default, but the Mailer plugin functionality simply does not meet complex requirements such as customizing message headers, content, and so on. Extended e-mail Notification (ext mail) is a more complete, use is also more complex plug-in, this article summarizes my experience and "Jenkins Learning Exchange" Group of people often encounter problems, such as the wrong environment to communicate. According to the use of experience and "Jenkins Learning Communication" Group of common problems, we recommend that you configure and use this extended e-mail notification the following 5 points: The sender mailbox and the system administrator mailbox are the same Depending on the mailbox service provider, the SMTP server is determined, such as: 126 SMTP is smtp.126.com, 163 SMTP is smtp.163.com
Determine whether SMTP authentication is used, whether the SSL protocol is used, and the SMTP port based on the mailbox service provider
According to the mailbox service provider determines whether the "Password" is the login password for the mailbox or the verification code that is dedicated to third-party tools, such as: QQ and 163 for the verification Code, 126 for the login password
Tick "Enable Debug Mode" To open the debug function of Extended e-mail notification, so as to add more log ext related to Extended e-mail notification in the build log The Mail plugin does not provide the test functionality of the SMTP configuration as Mailer plugin (many people misuse Mailer plugin's testing capabilities) and can only test the configuration correctly after being used in the jobConfigurationThis article only describes the configuration that I think is important, and does not include all the configuration items, which are divided into the "Basic Configuration" and "Extended Configuration" two parts.Basic ConfigurationBasic configuration is based on the use of extended e-mail notification, most of the people just contact the configuration problem is also shown here, and this part of the configuration and Jenkins's default mail notification plug-in Mailer plugin configuration is the same, please refer to the blog jenkins--application-Plug-ins use--mailer Plugin. The contents are as follows:

Click "Advanced ..." in the image above to expand as follows:

Extended Configuration
Configuration InstructionsDefault Context Type
The optional options are "Text/plain", "text/html", and are the format of the message body. is part of the Mail Standard protocol, related to how the mailbox client resolves the message content, not the core content of this article, do not further explain, generally speaking, "text/plain" means the message body is plain text format, "text/html" means that the message content can contain HTML tags and can be correctly parsed and displayed by the mailbox client. The actual work is only "text/html" more commonly used.
Default Recipients
The default mail notification recipient, if the job does not reset "Recipients", the plugin will send the message to the recipient here. In the job, you can use $default_recipients to include the default recipients and add new recipients, such as: $DEFAULT _recipients,123456@qq.com. The recipient list can also include the "CC" and "BCC" prefixes, which represent CC and BCC, for example: cc:123456@qq.com,bcc:78910@qq.com.
Reply to List
The list of recipients when replying to a message is part of the standard protocol for the message and is related to the implementation of the mailbox client, and is not described in detail because it is beyond the scope of this article. The role is to automatically set the recipient mailbox list when the message notifies the recipient to use the mailbox client to reply to the message, such as "45678@qq.com,23456789@qq.com", and the recipient of the message notification is 123456@qq.com, when 123456@ Qq.com you reply to a received message, 45678@qq.com,23456789@qq.com appears in the recipient list, and you can use $default_repytow in the job and add a new mailbox.
Default Subject
Message headers, you can use the environment variables in the build to make the headings more flexible and more expressive.
Default Content
Message content, you can use environment variables in the build. Is the most important part of our actual use, we will show you an example in the "Use" section.

Configuration InstructionsEnable Debug Mode
After the plug-in installation is not selected by default, here again, it is important to check this plug-in when you first contact this option. Content Token Reference
A description of the available variables for the plugin to use when customizing the header and content of the message, click "?" in the bottom right corner of the image above. You can see a description of all the variables, and in more detail, the variables used are described in the example for the "Use" section. Click "Default Triggers ..." in the image above to expand all of the triggering methods supported by the plugin, as shown below:
I am a bit confused about the role of "default Triggers ...", from the actual use of the settings in the job will not be the default, such as the above image set the trigger mode is "always", but in the job if you do not specify a trigger will not send mail notification.UseIn the job "post-build Actions" Select the "Editable Email Notification" option to use extended e-mail Notification plug-in, this section first describes some useful configuration, A specific example is then used to illustrate how to use the job.Configuration InstructionsDisable Extended Email Publisher
Feel this is a very intimate setting, it allows us to temporarily shut down the job's email notification function, secretly do something without being discovered. When we want to verify some of our ideas have to run the job repeatedly, and do not want to send an email every time to disturb others, it seems very intimate. Project Recipient List
Comma-separated collection of my list, the default value is $default_recipients, which is "default RECIPIENTS" in the "Extended Configuration" section above, where you can reset or add new recipients as needed. Project reply-to List
Well delimited list of reply message recipients, the default value is $default_replyto, which is the "Reply to List" in the previous section, "Extended Configuration", and is modified in the same way as Project Recipient list. Default Subject
From the name and "Default Subject" in the "Extended configuration" in the previous section is duplicated, but its scope is different, "extended Configuration" is global, here is only valid in the current job, and can be overridden by the settings in "Trigger". Default Content
The difference between "Default Content" and "Extended Configuration" in the previous section is the same as above. Attachments Usage Recommendations
1) Some global settings cannot be inherited by triggers, as far as possible, set individually in each trigger, such as "Default Recipient"
2) If the MAVEN project Test_counts gets the test case information, the surefire plugin needs to be configured in the POMExampleSend the following content in HTML: The message content is the project name, number of builds, trigger reason, top 100 lines of build log, project url/build log URL, Project change log, test case summary.
In the job settings, "Content Type" is selected "Html" to paste the following template contents into "content".
HTML Template: Template by group friends QQ] TUX (4991727) offers

<! DOCTYPE html> 
effect Diagram (part):




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.