Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

email-ext-plugin

> DevOps
Open source

Jenkins Email Extension Plugin

370 stars0 likes1 views
WebsiteGitHub

About

Jenkins Email Extension Plugin

[[email-ext-plugin]] = Email Extension Plugin :toc: macro :toc-title: ifdef::env-github[] :tip-caption: :bulb: :note-caption: :information_source: :important-caption: :heavy_exclamation_mark: :caution-caption: :fire: :warning-caption: :warning: endif::[]

https://ci.jenkins.io/job/Plugins/job/email-ext-plugin/job/main/[image:https://ci.jenkins.io/buildStatus/icon?job=Plugins%2Femail-ext-plugin%2Fmain[Build Status]] https://github.com/jenkinsci/email-ext-plugin/graphs/contributors[image:https://img.shields.io/github/contributors/jenkinsci/email-ext-plugin.svg[Contributors]] https://plugins.jenkins.io/email-ext[image:https://img.shields.io/jenkins/plugin/v/email-ext.svg[Jenkins Plugin]] https://github.com/jenkinsci/email-ext-plugin/releases/latest[image:https://img.shields.io/github/release/jenkinsci/email-ext-plugin.svg?label=changelog[GitHub release]] https://plugins.jenkins.io/email-ext[image:https://img.shields.io/jenkins/plugin/i/email-ext.svg?color=blue[Jenkins Plugin Installs]]

This plugin allows you to configure every aspect of email notifications. You can customize when an email is sent, who should receive it, and what the email says.

toc::[]

== Introduction

This plugin extends the https://plugins.jenkins.io/mailer/[Mailer plugin]'s functionality by giving you more control. It provides customization of three areas:

Triggers:: Select the conditions that should cause an email notification to be sent. Content:: Specify the content of each triggered email's subject and body. Recipients:: Specify who should receive an email when it is triggered.

== Questions and issues

If you need help, please post on the https://jenkins.io/mailing-lists/[Jenkins users mailing list] or https://stackoverflow.com/questions/tagged/email-ext[Stack Overflow].

Report bugs and requests for enhancement in the https://issues.jenkins.io/[Jenkins issue tracker] (no support tickets, please). Use the email-ext-plugin component in the JENKINS project.

== Documentation

  • xref:docs/recipes.adoc[Recipes]
  • https://github.com/jenkinsci/.github/blob/main/CONTRIBUTING.md[Contribution guidelines]
  • xref:CHANGELOG.adoc[Changelog]

== Getting started

=== System-wide configuration

Before using this plugin from a project, you must first configure some system-wide settings. Go to the Jenkins system-wide configuration page (Manage Jenkins, Configure System).

The configuration for this plugin can be found in the section entitled Extended E-mail Notification. This configuration should match the settings for your SMTP mail server. This section mirrors that of the https://plugins.jenkins.io/mailer/[Mailer plugin] in the E-mail Notification section; however, there are a few additions. The fields labeled Default Subject and Default Content allow you to configure the subject and content on a system-wide level. The field labeled Default Recipients can be used to set a default list of email addresses for all projects using this plugin (and can be overridden at the project level); this can be used to greatly simplify the configuration you need to do for all projects.

=== Project configuration

For a project to use this plugin, you need to enable it in the project configuration page. In the Post-build Actions section, click on Add post-build action and then select Editable Email Notification.

There are three main fields that you can edit when this plugin is enabled:

Project Recipient List:: This is a comma (or whitespace) separated list of email recipients. It allows you to specify a single recipient list for each email that is sent. Default Subject:: This allows you to configure a token (more about tokens later) that can be used to easily configure all email subjects for the project. Default Content:: Same as Default Subject, but for the email body instead of the subject.

=== Pipeline step

This plugin can be used from https://www.jenkins.io/doc/book/pipeline/[Pipeline] via the https://jenkins.io/doc/pipeline/steps/email-ext/[`emailext`] step:

[source,groovy]

emailext body: 'Test Message', subject: 'Test Subject', to: '[email protected]'


Use the recipientProviders parameter to add additional recipients. For example, to add all the people who caused a change in the change set and the user who initiated the build:

[source,groovy]

emailext body: 'Test Message', recipientProviders: [developers(), requestor()], subject: 'Test Subject', to: '[email protected]'


The recipient providers from this plugin can also be used with the https://plugins.jenkins.io/mailer/[Mailer plugin]. For example, to add culprits and the user who initiated the build:

[source,groovy]

step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([culprits(), requestor()])])

== Usage

To see the advanced configuration for this plugin, click on the Advanced button. This section allows you to specify recipients for each type of email trigger as well as a pre-send script that can be used to modify the email prior to sending.

=== Pre-send scripts and post-send scripts

This feature allows you to write a script that can modify the https://eclipse-ee4j.github.io/mail/docs/api/jakarta.mail/jakarta/mail/internet/MimeMessage.html[`MimeMessage`] object before or after sending the email. This allows adding custom headers, modifying the body, etc. Predefined variables include:

msg (https://eclipse-ee4j.github.io/mail/docs/api/jakarta.mail/jakarta/mail/internet/MimeMessage.html[`jakarta.mail.internet.MimeMessage`]):: The MIME email message object, which can be modified. logger (https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html[`java.io.PrintStream`]):: A PrintStream that can be used to log messages to the build log. build (https://javadoc.jenkins.io/hudson/model/AbstractBuild.html[`hudson.model.AbstractBuild`]):: The build this message belongs to (only use with Freestyle projects). run (https://javadoc.jenkins.io/hudson/model/Run.html[`hudson.model.Run`]):: The build this message belongs to (may be used with Freestyle projects or Pipeline). cancel (boolean):: When set to true, cancels the sending of the email.

=== Triggers

By default, the only trigger configured is the Failure - Any trigger. To add more triggers, select one from the drop-down and it will be added to the list. To see what conditions must be met for this plugin to send an email, click on the "?" (question mark) next to the trigger.

==== Extended Email Publisher Triggers

The following triggers are available as part of the Extended Email Publisher plugin, other plugins can provide triggers as well, through the extension point defined in the Extended Email Publisher:

Aborted:: An email will be sent if the build status is "Aborted". A build is aborted via the UI or API, but normally requires some sort of user intervention to occur. An aborted build is stopped during its execution. Always:: Always triggers an email after the build, regardless of the status of the build. Before Build:: An email will be sent when the build begins, but after SCM polling has completed. Failure -> Unstable (Test Failures):: An email will be sent any time the build goes from failing (compilation or build step failures) to unstable (unit test failures). This basically means that all the builds steps were successful, but there are still tests failing. Failure - Any:: An email will be sent any time the build fails. If the "Failure - Still" trigger is configured, and the previous build status was "Failure", then the "Failure - Still" trigger will send an email instead. Failure - 1st:: An email will be sent when the build status changes from "Success" to "Failure". Failure - 2nd:: An email will be sent when the build fails twice in a row after a successful build. Failure - Still:: An email will be sent if the build status is "Failure" for two or more builds in a row. Failure - X:: An email will be sent when the build fails X times in a row after a successful build Fixed:: An email will be sent when the build status changes from "Failure" or "Unstable" to "Success". Not Built:: An email will be sent if the build status is "Not Built". This status code is used in a multi-stage build (like maven2) where a problem in earlier stage prevented later stages from building. Script - After Build:: Allows the user to define a script that is executed to determine if an email should be sent AFTER the build occurs. The last line of the script should resolve to true to send an email, or false to not send an email. See > below for parameters available to the script. Script - Before Build:: Allows the user to define a script that is executed to determine if an email should be sent BEFORE the build occurs. The last line of the script should resolve to true to send an email, or false to not send an email. See > below for parameters available to the script. Status Changed:: An email will be sent if the build status changes. Success:: An email will be sent if the build status is "Successful". If the "Fixed" trigger is configured, and the previous build status was "Failure" or "Unstable", then the "Fixed" trigger will send an email instead. Test Improvement:: An email will be sent any time there is an improvement. A build is considered to have improved whenever it has fewer test failures than the previous build. If the current failure count went to 0 (no more test failures) this trigger will NOT send an email. Test Regression:: An email will be sent any time there is a regression. A build is considered to regress whenever it has more failures than the previous build, or if there are new tests that failed. Unstable (Test Failures):: An email will be sent any time the build is unstable. A build is unstable if there are test failures, but all the build steps completed successfully. If the "Unstable - Still" trigger is configured, and the previous build status was "Unstable", then the "Unstable - Still" trigger will send an email instead. Unstable (Test Failures) - 1st:: An email will be sent when the build status changes from anything to "Unstable". Unstable (Test Failures) - Still:: An email will be sent if the build status is "Unstable" for two or more builds in a row. A build is unstable if there are test failures, but all the build steps completed successfully. Unstable (Test Failures)/Failure -> Success:: An email will be sent when the build status changes from "Failure" or "Unstable" to "Success". Intermediate "Aborted" builds are ignored.

==== Common Trigger Options

Once you have added a trigger, you have several common options (there may be additional options available depending on the trigger implementation):

Recipient List:: Add this recipient provider if you would like to have the email sent to the Project Recipient List configured above. Developers:: Add this recipient provider to send the email to anyone who checked in code for the last build. This plugin will generate an email address based on the committer's ID and the appended Default user e-mail suffix from the Extended E-mail Notification section of the Configure System page. For example, if a change was committed by someone with an ID of first.last, and the default user e-mail suffix is @example.com, then an email will be sent to [email protected]. Requestor:: Add this recipient provider to send an email to the user who initiated the build (if initiated by a user manually). Include Culprits:: If this recipient provider and the Developers recipient provider are added, emails will include everyone who committed since the last successful build. Previous:: Add this recipient provider to send an email to the culprits, requestor and developers of the previous build(s). Advanced:: Configure properties at a per-trigger level: Recipient List::: A comma (or whitespace) separated list of email addresses that should receive this email when it is triggered. This list is appended to the *Project Recipient Li

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaemailjenkins-builderjenkins-plugin

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理