Skip to end of metadata
Go to start of metadata

Please do not email me directly (Jenkins/plugin developers excluded). If you need help post on the mailing lists https://jenkins.io/mailing-lists/, stack overflow or if you have found a bug log an issue at https://issues.jenkins-ci.org (no support tickets please)

Plugin Information

View Email Extension on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

This plugin is up for adoption. Due to poor health I am looking for a co-maintainer. Click here to learn more!

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.

Build Status

Recipes

Additional recipes for email-ext can be found here.

General

This plugin extends Jenkins built in email notification functionality by giving you more control.  It provides customization of 3 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.

Configuration

Global configuration

Before using email-ext on a project, you must configure some global settings.  Go to Jenkins System configuration page.  Manage Jenkins -> Configure System

The section titled Extended E-mail Notification is where you can configure global email-ext properties.  The properties here should match the settings for your smtp mail server.  This section is set up to mirror Jenkins own email Publisher Reporter (It's different extension point), however there are a few additions.  The inputs labeled Default Subject and Default Content, allow you to configure the email content on a global level.  The input labeled Default Recipients can be used to set a default list of email addresses for all projects using plugin (it 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 the email-ext plugin, you need to enable it in the project configuration page.  Select the checkbox labeled "Editable Email Notification" in the  "Post-build Actions" section.

Basic Configuration

There are three fields that you can edit when the plugin is enabled.

  • Global Recipient List - This is a comma (or whitespace) separated list of email recipients.  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.

Advanced configuration

To see the advanced configuration for the plugin, first click on Override Global setting checkbox, then click 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 just prior to sending. 

Pre-send Script

The pre-send script is a feature which allows you to write a script that can modify the MimeMessage object prior to sending. This would allow adding custom headers, modifying the body, etc. Predefined variables include:

  • msg - the MimeMessage object which can be modified
  • logger - a PrintStream and will write to the job's log. 
  • build - the build this message belongs to
  • cancel - a boolean, which when set to true will cancel the sending of the email

Triggers

By default, the only trigger configured is the "Failure" trigger.  To add more triggers, select one from the dropdown, and it will be added to the list.  Once you have added a trigger, you have several options.  If you click "?" (question mark) next to a trigger, it will tell you what conditions must be met for it to send an email.

  • Send to Recipient List - Check this checkbox if you would like to have the email sent to the "Global Recipient List" configured above.
  • Send to Developers  - Check this checkbox to send the email to anyone who checked in code for the last build.  The plugin will generate an email address based on the committer's id and an appended "default email suffix" from Jenkins's global configuration page.  For instance, if a change was committed by someone with an id "first.last", and the default email suffix is "@somewhere.com", then an email will be sent to "first.last@somewhere.com"
  • Send To Requester - If this is checked, an email will be sent user who triggers the build (if triggered by a user manually).
  • Include Culprits - If this is checked AND Send To Developers is checked, emails will include everyone who committed since the last successful build.
  • More Configuration - Configure properties at a per-trigger level.
    • Recipient List - A comma (and whitespace) separated list of email address that should receive this email if it is triggered.  This list is appended to the "Global Recipient List" above.
    • Subject - Specify the subject line of the selected email.
    • Content - Specify the body of the selected email.
  • Remove - Click the delete button next to an email trigger to remove it from the configured triggers list.

You can use Trigger Scripts in groovy to define before of after the build if the email must be send or not.

There are four objects added to the model for the script to use to interact with the build.

  • build: This is the current build, usually a child class of AbstractBuild
  • project: The project object that the current build was started from, usually a child class of AbstractProject
  • rooturl: The Jenkins instance root URL, useful for links.
  • out: A PrintStream that can be used to log messages to the build log.

The last line in the script should resolve to a boolean true or false

Examples:

  • Before build scripts
// this could be used to notify people that a new build is happening
build.previousBuild.result.toString().equals('FAILURE')
  • After build scripts
// only send am email if the build failed and 'mickeymouse' had a commit
build.result.toString().equals('FAILURE') && build.hasParticipant(User.get('mickeymouse'))
// only send an email if the word {{ERROR}} is found in build logs
build.logFile.text.readLines().any { it =~ /.*ERROR.*/ }

Email tokens

The email-ext plugin uses tokens to allow dynamic data to be inserted into recipient list, email subject line or body.   A token is a string that starts with a $ (dollar sign) and is terminated by whitespace.  When an email is triggered, any tokens in the subject or content fields will be replaced dynamically by the actual value that it represents.  Also, the "value" of a token can contain other tokens, that will themselves be replaced by actual content.  For instance, the $DEFAULT_SUBJECT token is replaced by the text (and other tokens) that is in the Default Subject field from the global configuration page.  Similarly, the $PROJECT_DEFAULT_SUBJECT token will be replaced by the value of the Default Subject field from the project configuration page

The email-ext plugin sets the email content fields with default values when you enable it for your project.  The Default Subject and Default Content fields on the project config page default to $DEFAULT_SUBJECT and $DEFAULT_CONTENT (respectively), so that it will automatically use the global configuration.  Similarly, the per-trigger content fields default to $PROJECT_DEFAULT_SUBJECT and $PROJECT_DEFAULT_CONTENT, so that they will automatically use the project's configuration.  Since the value of a token can contain other tokens, this provides different points of configuration that can allow you to quickly make changes at the broadest level (all projects), the narrowest level (individual email), and in between (individual project).

To see a list of all available email tokens and what they display, you can click the "?" (question mark) associated with the Content Token Reference at the top bottom of the email-ext section on the project configuration screen.

Token Macro Tokens

As of version 2.22, email-ext supports tokens provided by the token-macro plugin. You can see the available token-macro token below the email-ext tokens when you click the "?" (question mark) associated with the Content Token Reference at the bottom of the email-ext section on the project configuration screen.

Jelly content

New to version 2.9 is the ability to use Jelly scripts. Jelly scripts are powerful in that you can hook into the Jenkins API itself to get any information you want or need. There are two Jelly scripts packaged with the plugin and it is possible to write your own too.

There are two default Jelly scripts available out of the box; one is designed for HTML emails and the other is design for text emails. See the screenshots to the right for what these templates look like. You can specify which script you want by using the template argument. The usage for each script is the following:

  • Text only Jelly script: ${JELLY_SCRIPT,template="text"}
  • HTML Jelly script: ${JELLY_SCRIPT,template="html"}

You can also write your own Jelly scripts. The Jelly scripts are particularly powerful since they provide a hook into the Jenkins API including hudson.model.AbstractBuild and hudson.model.AbstractProject. For example on how to do this, take a look at the existing html and text scripts.

Using custom Jelly scripts (those not packaged with email-ext) requires the cooperation of your Hudson administrator. The steps are relatively simple:

  1. Create the Jelly script. The name of the script should be <name>.jelly. It is important the name ends in .jelly.
  2. Have your Jenkins administrator place the script inside $JENKINS_HOMEemail-templates.
  3. Use the Jelly token with the template parameter equal to your script filename without the .jelly extension. For example, if the script filename is foobar.jelly, the email content would look like this ${JELLY_SCRIPT,template="foobar"}.

Jelly script tips:

  • You get object of other plugin actions by querying build actions like: ${it.getAction('hudson.plugins.fitnesse.FitnesseResultsAction')}
  • Then you need to know what all functions are allowed by this action object and traverse through result.

Script content

New to version 2.15 is the ability to use Groovy scripts. Scripts are powerful in that you can hook into the Jenkins API itself to get any information you want or need. There are two scripts with corresponding templates packaged with the plugin and it is possible to write your own too.

There are two default scripts and templates available out of the box; one is designed for HTML emails and the other is design for text emails. You can specify which script you want by using the script _argument, you can also just leave the default script and specify a different template file using the _template argument. Further, you can also include an init script that does some initialization using the init argument. The usage for each script is the following:

  • Text only template: ${SCRIPT, template="groovy-text.template"}
  • HTML template: ${SCRIPT, template="groovy-html.template"}

You can also write your own scripts and templates. The scripts are particularly powerful since they provide a hook into the Jenkins API including hudson.model.AbstractBuild and hudson.model.AbstractProject. For example on how to do this, take a look at the existing html and text scripts.

Using custom scripts (those not packaged with email-ext) requires the cooperation of your Jenkins administrator. The steps are relatively simple:

  1. Create the script/template. The name of the script end in the standard extension for the language (.groovy). The template can be named anything
  2. Have your Jenkins administrator place the script inside JENKINS_HOME\email-templates.
  3. Use the script token with the template parameter equal to your template filename, or in addition the script parameter equal to the custom script name. For example, if the template filename is foobar.template, the email content would look like this ${SCRIPT, template="foobar.template"}.

Template Examples

These are some useful examples for doing various things with the email-ext groovy templates.

jenkins-matrix-email-html.template

jenkins-generic-matrix-email-html.template

Pipeline Examples

See email-ext for command signatures

Notify Culprits and Requester via default EMail plugin

step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])])

Send an email to abc plus any addresses returned by the providers

emailext body: 'A Test EMail', recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: 'Test', to: 'abc'


Attachments

New to version 2.15 is the ability to add attachments using the Ant pattern matching syntax used in many places in Jenkins. You can set a maximum total attachment size in the global configuration page, or it will be unlimited. 

Jive Formatter

jive-formatter.groovy contains methods for easy and convenient formatting of emails being sent from Jenkins to Jive. It should be called from the Pre-send Script area.

Also, it doesn't seem like Jive supports text with multiple formats, so only call one formatting method per block of text.

Either formatLine or formatText can and should be called on every line of text that will be sent to the Jive system prior to calling formatting methods like color or size. Please test on your own instances of Jive and add functionality as you find it!

The following lines should be added to the Pre-send Script area prior to attempting to invoke any functions.

Pre-send Script
File sourceFile = new File("/your/preferred/path/jive-formatter.groovy");
Class groovyClass = new GroovyClassLoader(getClass().getClassLoader()).parseClass(sourceFile);
GroovyObject jiveFormatter = (GroovyObject) groovyClass.newInstance();

Plugins

Extend Email-ext

 Make sure you have installed Maven 3 (why?) and JDK 6.0 or later. Make also sure you have properly configured your ~/.m2/settings.xml as explained in the Plugin Tutorial. This is needed to build properly any Jenkins plugin.

Check out and build

How to check out the source and build:

  • git clone git@github.com:jenkinsci/email-ext-plugin.git
  • cd email-ext-plugin
  • mvn clean install

Version History

2.62 (March 23, 2018)

  • Styling changes + change in test results table + code alignment (pull 162)
  • Fix link for RFC-2919 in help (pull 164)
  • Update some libraries for some feature additions. (pull 165)

  • The email-ext-plugin Pipeline integration is not very ergonomic  JENKINS-49733 - Getting issue details... STATUS
  • Check for attachment size does not consider compression  JENKINS-49913 - Getting issue details... STATUS
  • Add additional accounts (pull 166)

2.61 (October 27, 2017)

  • Add global checkbox to allow sending emails to unregistered users (pull 161)
  • Switch to using RunWithSCM for getCulprits logic  JENKINS-24141 - Getting issue details... STATUS

2.60 (September 19, 2017)

  • groovy-text.template: use of member changeSet instead of changeSets (JENKINS-38968)

2.59 (September 12, 2017)

  • NullPointerException when calling addRecipients (JENKINS-45529)
  • groovy-html.template: use of member changeSet instead of changeSets (JENKINS-38968)

2.58 (Jun 29, 2017)

  • Make message clearer added in SECURITY-372
  • Add presend and postsend script support in pipeline (#157)
  • allRecipients could be null if presend script remove all of them (#156)

2.57.2 (April 10, 2017)

  • SECURITY-257(advisory)  Run Groovy and Jelly scripts only if approved or in secure sandbox

Jenkins administrators may need to approve scripts used by this plugin. Administrators can either proactively review all job configurations for Groovy scripts or they can wait for the jobs to run and fail. Approval is performed via the Script Security Plugin.

 

2.57.1 (March 20, 2017)

  • SECURITY-372 (advisory) Emails were sent to addresses not associated with actual users of Jenkins.

If the security fix is undesirable in a particular instance, it can be disabled with either or both of the following two system properties:

  • -Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true: send mail to build culprits even if they do not seem to be associated with a valid Jenkins login.
  • -Dhudson.tasks.MailSender.SEND_TO_USERS_WITHOUT_READ=true: send mail to build culprits associated with a valid Jenkins login even if they would not otherwise have read access to the job.


2.57 (February 18, 2017)

  • Allow using 'emailext' step in pipeline without 'node'/workspace context (JENKINS-42140)

2.56 (February 14, 2017)

  • Take 2 on previous

2.55 (February 11, 2017)

  • Bring back functions removed in JENKINS-40964 that are required for upgrade of existing config

2.54 (January 22, 2017)

2.53 (December 23, 2016)

  • CulpritsRecipientProvider does not work with pipeline (JENKINS-40653)

2.52 (October 23, 2016)

  • enable setter for smtpHost in descriptor (PR-142)
  • Fix getter value in UI (JENKINS-37995)
  • Add API to programmatically configure global settings (JENKINS-39147)

2.51 (September 28, 2016)

2.50 (September 24, 2016)

2.48 & 2.49 Failed releases

2.47 (August 7, 2016)

  • 2nd failure emails being sent even when build is successful with job-dsl-plugin (JENKINS-37188)

2.46 (August 4, 2016)

  • emailext Pipeline step sends mails to irrelevant people (JENKINS-37163)

2.45 (July 31, 2016)

2.44 (June 13, 2016)

2.43 (June 4, 2016)

  • Fixed Content Token Reference throwing error if Config File Provider plugin is not installed (issue 35289)
  • Fixed NPE when watching a job (Issue 33717)
  • Merged pull request 130
  • Merged pull request 133 Fix for issue 34785
  • Added ability to use a template from the workspace.

2.42 (April 17, 2016)

  • Fixed issue with post-send script not saving (issue 33205 thanks to weisslj)
  • Fixed issue with non-English characters in file names for attachments (issue 33574)
  • Fixed NPE issue when using groovy script (issue 33690)
  • Added a license file
  • Moved to new parent pom version
  • Fixed up some tests

2.41.3 (Feb 23, 2016)

  • Fixed issue when workflow is not installed (issue 33035)

2.41.2 (Feb 18, 2016)

2.41 (Feb 07, 2016)

  • Cleaned up dependencies
  • Removed several tokens that were moved to token-macro
  • Fixed several items flagged by PMD (thanks Mohammed Ezzat)
  • Added post-send script feature similar to pre-send script. (Thanks weisslj)
  • Fixed issue with non-AbstractProject/Build items (issue 29970https://issues.jenkins-ci.org/browse/JENKINS-29970)
  • Fixed watching so it doesn't show recipient fields (issue 29449)

2.40.5 (Jun 08, 2015)

  • Whitespace and import cleanup
  • DefaultTriggers refactoring

2.40.4 (May 24, 2015)

  • Fix issue where the wrong config provider would be cached if using multiple types of managed templates.

2.40.3 (May 20, 2015)

  • Fix issue with incorrect handling of cc and bcc recipients (issue #28444)
  • Fix issue with readResolve including Mailer components (issue #28402)
  • Fix issue where default extension was not added to template name if there was something that looked like an extension in the name (issue #28357)

2.40.2 (May 13, 2015)

  • Set the debug mode for JavaMail correctly when debug mode is enabled in global configuration
  • Fixed issue where the deserialization was not working correctly for descriptors (issue #28212)

2.40.1 (May 4, 2015)

  • Fixed issue with classpath entries that have environment variables (issue #28145)
  • Fixed issue with check of the extension for templates on the file system (issue #28202)

2.40 (April 28, 2015)

  • Thanks to K.R. Walker, Cédric Levasseur
  • Fixed issue with pre-send scripts not using 'cancel' correctly (issue #27448)
  • Added ability to send email in HTML and plaintext with plaintext being a stripped version of the HTML (issue #23126)
  • Added ability to configure the set of triggers that is setup by default when adding email-ext to a project (issue #27856)
  • Moved away from using the Mailer plugin to create a session.
  • Added new TEMPLATE token that can be used to pull normal content from a file (issue #26478)
  • Allow use of content tokens in the pre-send script (issue #26286)
  • Allow sending console logs for all nodes in matrix build (issue #21861)
  • Added ability for users to watch jobs (issue #18567)
  • Removed admin email address since it should be set in the Jenkins Location area (issue #25926)
  • Fixed output from CSSInliner that was escaping entities (issue #25719)
  • Added FirstFailingBuildSuspectsRecipientProvider

2.39.2 (January 30, 2015)

  • Thanks to Everspace
  • Add workaround for JENKINS-25940
  • Added new SCRIPT_CONTENT macro that can be used with pre-send scripts.
  • Added uberClassLoader to JellyContext

2.39 (November 16, 2014)

2.38.2 (August 26, 2014)

  • Switch to using getAction instead of getTestResultAction to work with newer versions of core.

2.38.1 (June 2, 2014)

  • Fix for NPE when no recipient providers are selected in a trigger.

2.38 (May 24, 2014)

  • Implemented new extension point for recipient providers (RecipientProvider) this changes the way that recipient types are added 
    • There are no longer checkboxes for "Requestor" "Recipients" etc, each is provided by an implementation of a RecipientProvider
  • Fixed log zipping to remove annotations (issue #21180)
  • Added help information for TRIGGER_NAME token (issue #21912)
  • Added support for managed files using the Config File Provider plugin, prefix managed file name with "managed:"
  • Removed dependency on the Maven plugin
  • Added more help and updated help messages to be more clear (issue #20384)
  • Added bcc support (issue #21730)
  • Added showMessage parameter to FAILED_TESTS to allow turning off error messages
  • Cleaned up template to remove duplicate sections (issue #22592)
  • Added %a and %d for pathFormat parameter of the CHANGES_SINCE* tokens (issue #20692)

2.37.2.2 (March 8, 2014)

  • Added caching to the private macros to reduce time (issue #20078)

2.37.2 (January 26, 2014)

  • Marked the Config subclass Extensions as optional, so the plugin doesn't cause issues if the Config File Provider plugin is not installed. (issue #21326)

2.37.1 (January 11, 2014)

  • Fix issue with missing dependency on maven-plugin in  pom.xml

2.37 (January 8, 2014)

  • Updated parent pom version to 1.532.1 LTS
  • Allow use of managed scripts for Jelly or Groovy content. Use prefix "managed:" before name of managed script (issue #18203)
  • Added new "Status Changed" trigger (thanks francois_ritaly)
  • Added fileNotFoundMessage to FILE token (issue #20325)
  • Added inline help for triggers that was missing (issue #20170)
  • Changed BuildStepMonitor.NONE to allow concurrent builds (thanks jglick) (issue #16376)** You must take care when using content or triggers that look at previous builds if you enable concurrent builds for your project
  • Added TRIGGER_NAME token so users can determine what trigger caused the email (issue #20265)
  • Changed to Mutlimap so that you can add multiple triggers of the same type and have them work correctly (issue #20524)
  • Fixed issue where pre-send script would get expanded and remain expanded (issue #20770)
  • Added First Unstable trigger
  • Added helper script for emailing Jive community (thanks Dan Barker)

2.36 (October 26, 2013)

  • Fixed issue with mismatch between form field name and what was parsed in the backend (issue #20133)
  • Fixed issue with NPE on 1.535 (thanks to agudian for the PR)
  • Added ability to customize the date format for the CHANGES_SINCE tokens (issue #20151)
  • Added help files for all the built-in triggers (issue #20170)
  • By default when you add the email-ext publisher, an Always trigger will be added (issue #20013)
  • Fixed issue with template project plugin based jobs and Jelly script content. (issue #20117)
  • If user doesn't have a Mailer.UserProperty, just add the user id and see if the system can resolve it (issue #20215)
  • Fixed issue with newInstance method for EmailTrigger causing an exception on 1.536 (issue #20198)

2.35.1 (October 14, 2013)

  • Fixed issue introduced by new parameter parsing in global config (issue #20030)
  • Update descriptor usage in triggers
  • Fixed command line to not max out PermGen during testing

2.35 (October 12, 2013)

  • Refactored descriptor to follow recommended method
  • Added tests for global config default values
  • Updated to latest LTS for parent version
  • Updated exclusion list to be for full email list, not just committers
  • Fixed issue with email-ext not restoring values for some fields if no triggers were configured (issue #15442)
  • Fixed issue where the project could be null (issue #14338)

2.34 (September 15, 2013)

  • Started adding HtmlUnit tests for UI interaction and round trip testing
  • Added more debug for excluded committers feature
  • Reverted field name to includeCulprits
  • Fixed issue where PROJECT_DEFAULT_RECIPIENTS was being added to triggers (issue #19583)
  • Fixed issue that stopped users from being able to add triggers (issue #19585)

2.33 (September 12, 2013)

  • Fixed issue with triggers for matrix projects not saving the value correctly (issue #19291)
  • Added ability to set content type at the trigger level
  • Added back send to culprits
  • Fixed missing dependency for Mailer plugin in pom.xml
  • Added setting debug mode for JavaMail when debug mode for email-ext is set

2.32 (August 13, 2013)

  • Fix issue with matrix project (issue #19190)
  • Added "Fixed Unhealthy" trigger

2.31 (August 12, 2013)

  • Changed way that triggers work so that you can add multiple triggers of the same type
  • Changed triggers into extension points so that other plugins can provide email triggers
  • Migrated all tokens to use the Token Macro plugin
  • Fixed issue with using template testing with Jelly scripts (issue #18157)
  • General clean-up of sources to remove unused imports and so forth
  • Added JUnit report into groovy html template (thanks praagii)
  • Fixed issue with wrong StringUtils being imported thanks to NetBeans (issue #19089)

2.30.2 (May 23, 2013)

  • Fix issue with escaping tokens by using a more groovy like method (double dollar $$) (issue #18014)
  • Fix issue with metaClass for Script (thanks to Geoff Cummings for patch) (issue #17910)
  • Added ability to test Groovy and Jelly templates via a link on the project page. (issue #9594)

2.29 (May 6, 2013)

  • Refixed typo in email template.
  • Updated to latest LTS release for base (1.509.1)
  • Added global user exclusion list (issue #17503)
  • Added expansion of environment variable in the FILE token's path argument (issue #16716)
  • Added trigger and triggered variables to pre-send script object model (issue #17577)
  • Added DEFAULT_PRESEND_SCRIPT token (issue #14508)
  • Added option to save the output of the generated email into the workspace (issue #13302)
  • Added new trigger for broken -> compiling state (17546)
  • Fixed default value for ReplyTo (issue #17733)
  • Turned off pretty-printing for the CssInliner (issue #17759)

2.28 (April 4, 2013)

  • Fixed token macro help in projects
  • Added additional Chinese translations
  • Improved help text for BUILD_LOG_EXCERPT token
  • Added support for inlining CSS and images into emails
  • Fixed regression in attaching build log (issue #17296)
  • Fixed regression in 1st Failure Trigger (issue #17307)
  • Updated docs for Improvement trigger (issue #17074)
  • Fixed class loading inside Groovy templates (issue #16990))
  • Removed script that created and used template usage
  • Cleaned up unused files

2.27.1 (March 5, 2013)

  • Fix issue with matrix configurations (issue #17064)
  • Add 1st Failure and 2nd Failure Triggers

2.27 (March 2, 2013)

  • Re-added ability to use tokens in attachment areas
  • Allow a default string if regex match is not found for BUILD_LOG_REGEX (issue #16269)
  • Fixed message layout if attachments are present (issue #16281)
  • Added info to the help on using the CC: mechanism
  • Fixed an issue with regression triggers (issue #16404)
  • Added a single retry if a SocketException occurs, in case the network issue was temporary (issue #16181)
  • Fixed attaching build log from a trigger.
  • Made default send to lists less verbose for certain triggers (issue #8642)
  • Added support for personal portions of email addresses ("Some Name" <username@email.com>) including support for unicode
  • Added check of return values from SendFailedException (issue #16919)
  • Made it much easier to use content tokens from groovy templates (issue #16916)
  • Fixed a typo in the html template (issue #16975)
  • Fixed groovy html template when Maven artifacts cause an exception (issue #16983)
  • Include Jacoco output in the default Jelly HTML template.

2.25 (December 12, 2012)

  • Fixed test failures on Mac OS
  • Fixed issue with NullReferenceException if the file doesn't exist for the FILE token (issue #15008)
  • Improved address resolution if the user is setup in the Jenkins system
  • Added a debug mode that will add extra log messages to the build log when enabled in the global config.
  • Updated to core 1.480
  • Added ability to add attachments at the trigger level (issue #13672)
  • Added option to attach the build log at either the project level, or at the trigger level (issue #13848)
  • Improved capture of failed email addresses (issue #16076)
  • Added ability to set Reply-To header value at global, project and trigger level. (issue #3324)* Added ability to set Reply-To header value at global, project and trigger level. (issue #3324)
  • Added parameter (maxLength) to FAILED_TESTS content token to allow truncating the test information. The maxLength is the number of KB allowed (issue #5949)* Added parameter (maxLength) to FAILED_TESTS content token to allow truncating the test information. The maxLength is the number of KB allowed (issue #5949)
  • Added ability to secure the pre-send script by adding a sandbox when enabled in the global config. (issue #15213)

2.24.1 (July 20, 2012)

  • Fixed a few tests which were erroring on Windows.
  • Fixed issue with very long token strings causing SOE (issue #14132)
  • Updated TEST_COUNTS token to include passing tests.
  • Fixed charset issue when using Jelly templates (issue #7997)
  • Allow nested content in JELLEY_SCRIPT tag (issue #14210)
  • Added onlyRegressions parameter to FAILED_TESTS token
  • Allow disable of newlines after each regex match (issue #14320)
  • Removed token macro error messages from logs (issue #9364)
  • Fixed issue when token-macro was older than expected (issue #14224)
  • Fixed changeset author issue with text template
  • Added new trigger for when a job first fails (issue #7859)
  • Allow specifying CC addresses (issue #6703)
  • Updated improvement trigger to only fire if there are failures, but less than previous build (issue #14500)

2.22 (June 15, 2012)

  • Added pre-send groovy script for modifying the MimeMessage and even cancelling the email altogether. (issue #12421)
  • Added support for the token-macro plugin (issue #9364)
  • Added try/catch around user email resolution (issue #13102)
  • Attachment file path now supports content tokens (issue #13563)
  • Fixed issues with tests causing OutOfMemory exception
  • Added BUILD_LOG_MULTILINE_REGEX that allows regexes to match even newlines

2.21 (May 16, 2012)

2.20 (April 12, 2012)

  • Fix issue with hierarchical projects (see [Hierarchical+projects+support|])
  • Updated html_gmail.jelly file to updated fields
  • Updated maven pom to use repo.jenkins-ci.org repository
  • Added scripts for regenerating html.jelly for inline CSS styles
  • Fix issue with Jenkins URL overriding (issue #13242)
  • Fix groovy template for git usage (issue #13192)
  • Fix NPE that causes build to hang (issue #12577)

2.19 ( Mar 24, 2012 )

  • Reimplement default (global) recipient list
  • Fixed default suffix lookup (issue #11731)
  • Added JOB_DESCRIPTION token (issue #4100)
  • Added BUILD_ID token (issue #11895)
  • Groovy template now correctly determines SUCCESS and FAILURE (issue #13191)
  • CHANGES now allows nested content (issue #5376)
  • Fixed NRE when recipientList is not in the saved config (issue #12047)
  • Emails now send when one or more of the recipients is an invalid recipient (issue #9006)
  • Fixed issues with default recipients (issue #11665)

2.18 ( Jan 31, 2012 )

  • Add maximum size limit to ${FAILED_TESTS} (JENKINS-11413)
  • Added improvement and regression triggers
  • Added ${BUILD_LOG_EXCERPT} token (issue #10924)
  • Added emergency reroute option
  • Made compatible with LTS 1.424
  • Email to requester is now correct (issue #9160)
  • Fixed configuration with promoted builds (issue #10812)
  • Only include the stack trace if showStacks is true (issue #3430)

2.16 (Nov 07, 2011)

  • More flexible firing control for matrix projects (JENKINS-8590)
  • E-mail trigger for aborted and "not built" results (JENKINS-10990)

2.15 (Sep 05, 2011)

  • Allow email-ext to attach files to emails (JENKINS-9018).
  • Default Recipients list does not appear in Jenkins global settings(JENKINS-10783).
  • Email to requester uses wrong email address (JENKINS-9160).
  • Allow using Groovy (or other JSR223 languages) to generate the email content.

2.14.1 (Jul 01, 2011)

2.14 (Apr 21, 2011)

  • Improved the portability of the default Jelly templates across different SCM implementations (whereas previously some of the information was only displayed for Subversion)
  • Send the "still unstable" email rather than the "unstable" email, when the previous status was fail, and the status before that was unstable. (JENKINS-5411)

2.13 (Mar 23 2011)

  • Fixed a bug where the html/text Jelly template fail to report the change log correctly for all SCMs but Subversion.
  • If an e-mail is supposed to be sent to the requester, follow the build triggering chain to find the root requester (JENKINS-7740)
  • Added an option to configure a List-ID header on emails.

2.12 (Feb 26, 2011)

  • Rerelease 2.11 to properly set required Jenkins version.

2.11 (Feb 19, 2011)

This version requires Jenkins 1.396 or newer.

  • Added Charset option. (JENKINS-8011)
    • Added "hudson.plugins.emailext.ExtendedEmailPublisher.Content-Transfer-Encoding" system property to specify "Content-Transfer-Encoding".
  • Added "Requester" as possible mail destination (JENKINS-7740)
  • Need tokens to get failed tests count and total tests count, to put them in mail subject easy. (JENKINS-5936)
  • Introduce $JENKINS_URL and deprecated $HUDSON_URL.
  • i18n & l10n(ja)

2.10 (Jan 20, 2011)

  • Added a new content token "FILE" that includes a file from the workspace.
  • BUILD_LOG_REGEX Token:
    • Add escapeHtml - If true, escape HTML. Defaults to false.
    • Add matchedLineHtmlStyle - If non-null, output HTML. Matched lines will become <b style="your-style-value">html escaped matched line</b>. Defaults to null.
  • Prevent duplicate email notifications. (JENKINS-8071)

2.9 (Oct 14, 2010)

  • The showPaths argument was not working for CHANGES_SINCE_LAST_UNSTABLE and CHANGES_SINCE_LAST_SUCCESS. (issue #5486)
  • Add support for custom Jelly script content (JELLY_SCRIPT) (issue #7514)

2.8 (Sept 15, 2010)

This version requires Hudson 1.356 or newer.

  • Update BUILD_LOG_REGEX to properly handle console notes. (issue #7402)
  • Fixed password being saved in plaintext. (issue #5816)
  • Override "Hudson URL" only when "override global settings" is checked. (issue #6193)
  • Add escapeHtml parameter to BUILD_LOG content for escaping HTML. Defaults to false for backwards compatibility. (issue #7397)

2.7 (Aug 30, 2010)

  • New optional arg: ${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines, substText} which allows substituting text for the matched regex. This is particularly useful when the text contains references to capture groups (i.e. $1, $2, etc.)

2.6 (Jul 20, 2010)

  • Add ${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines} token.
  • Add token for build cause. (JENKINS-3166)
  • Add "changes since last unstable build" token. (JENKINS-6671)
  • Fix issue with node properties not being available for the $ENV token. (JENKINS-5465)
  • Recipient list can now use parameters. (JENKINS-6396)
  • Improve docs regarding use of quotes for string parameters. (JENKINS-5322)

2.5 (Jan 20, 2010)

  • Fix issue with adding a pre-build trigger using $BUILD_STATUS would make the build appear as if it was successful or fixed when the build hadn't actually ran yet. (issue #953)
  • Fix NullPointerException when no root URL is configured. (issue #1771)
  • $CHANGES_SINCE_LAST_SUCCESS was not showing unstable or aborted builds in the list of changes since the last successful build. (issue #3519)

2.4 (Jan 7, 2010)

  • Fix bug in 2.3 release that broke saving project config changes if Promoted Builds plugin is not also installed. (JENKINS-5208)
  • Fix in overriding global email settings.
  • Fix to allow authentication without SSL.
  • Send emails as replies to previous ones for same project, as done in Hudson's built-in emailer. (JENKINS-3089)
  • New "Before Build" trigger type. (JENKINS-4190)

2.3 (Jan 6, 2010)

  • Change the token handling to allow for passing of arguments, and allow arguments for the BUILD_LOG, CHANGES, and CHANGES_SINCE_LAST_SUCCESS tokens. (JENKINS-3085)
  • Revamp the help. Now have help on each form element in the config. Rearranged help files hierarchially and deleted unused help.
  • Allow HTML content in emails. There is a global preference plus a per-project preference, which default to plain text.
  • When the emailer can not process an email address, it now prints to the builder output. (JENKINS-1529)
  • Allow use of any environment variable. (JENKINS-3605)
  • Add ability to re-use "global" settings (i.e. settings from the core Mailer configuration)
  • Add support for SVN_REVISION
  • Fix for email triggers with space in name. (JENKINS-3614)
  • Update code for more recent Hudson.
  • Fixed help links. (JENKINS-4566)
  • Compatibility with Promoted Builds Plugin.

2.2.1 (Dec 23, 2008)

204 Comments

  1. Unknown User (f.copperfield@gmail.com)

    How do I create a contiguous string out of tokens, if each token is delimited by whitespace?

    For example, I want to have the following in my email text:

    FindBugs - http://mycompany.com/myproject/findbugsResult/

    so would like to use the following template

    FindBugs - $BUILD_URLfindbugsResult/

    as the BUILD_URL token would be substituted by

    http://mycompany.com/myproject/

    Of course, this does not work as there is no trailing whitespace after the token reference. I think it would be better to have the token references start and end with a dollar sign, so that this kind of thing is achievable.

  2. Can you actually include the files that changed with the $CHANGES token?

    From what i can see in the code

    ${CHANGES, showPaths=true}

    should work, however it doesn't so i assume im doing it wrong or it's still a work in progress.

    Anyone got it to work?

  3. How to use build parameters as tokens?

    For example, I have defined PROJECT_BUILD_NAME as build parameter When I use $PROJECT_BUILD_NAME, it does not print the value in the parameter, instead it prints parameter name.

    1. I've the same problem!

  4. Unknown User (kabadi)

    Anyone have any luck with,

    ${CHANGES, showPaths=true}
    

    Also, what is the username and password for accessing the source code?

  5. Unknown User (jvizueta)

    I would also like to know how to add the files changed, I think it's a very important feature, does anybody know how to get this done? the code mentioned doesn't work for me either, I get the same behavior than the one described by KC Baltz in the following thread http://www.nabble.com/Sending-emails-with-detailed-changes--td22252613.html

    Should I use the hpi published in the next address, or does email-ext plugin has this feature natively? http://techkriti.wordpress.com/2008/08/30/using-groovy-with-hudson-to-send-rich-text-email/

  6. Unknown User (kingink)

    is there an email token for the list of Committers, I would like to have the user name as part of the blame email subject

  7. Unknown User (yunshan)

    When I use Email-ext plugin to send mail, the following error come up:
    BUILD SUCCESSFUL
    Total time: 0 seconds
    Email was triggered for: Success
    There are 1 triggered emails.
    Sending email for trigger: Success
    Sending e-mails to: xxxxxxx
    ERROR: Could not send email as a part of the post-build publishers.
    com.sun.mail.smtp.SMTPSendFailedException: 454 5.7.3 Client does not have permission to submit mail to this server.
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
    at javax.mail.Transport.send0(Transport.java:169)
    at javax.mail.Transport.send(Transport.java:98)
    at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:256)
    at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:241)
    at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:199)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:583)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:564)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:551)
    at hudson.model.Build$RunnerImpl.cleanUp(Build.java:158)
    at hudson.model.Run.run(Run.java:1221)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:122)
    Finished: SUCCESS

  8. Unknown User (yunshan)

    I want debug the email process, so

    Is there any way to put the com.sun.mail package under debug traces?

  9. Unknown User (yunshan)

    It would be a bug with Email-ext plugin, with the same configuration, the basic E-mail Notification works all right, but the Email-ext works failed.

    Anyone can help?
    Thanks!

  10. Unknown User (yunshan)

    I followed the  "Using Groovy with Hudson to send rich text email" to config and send mail.

    and I found when the content contains Chinese characters, it would presented as ?????,

    I have tried many time, to change configurations, but it still get better.

    Is it a bug of Email-ext when handle utf-8 characters?

  11. Same problem as the one highlighted by Pramod Reddy Chinthapalli on June 04, 2009.

    It seems to be impossible to use build parameters as tokens - Look also at Issue 2413

    It would be very very useful, instead!

    1. Unknown User (mhughes@londonstockexchange.com)

      To use build parameters as tokens, it seems the syntax is:

      ${ENV,var="parametername"}

      e.g., for a parameter named SRC_BUILD_BRANCH:

      ${ENV,var="SRC_BUILD_BRANCH"}

      It's just taken me a good little while to go through all the possible permutations and find the exact syntax that works!

      1. Thank you very much Mark!

        With your hint, I changed also the issue above and marked as Fixed.

  12. Can this method be used in the "Recipient list" as well?  I'm not having any luck using an environment variable with this method.  I can use the same variable in the subject/content text and it works fine.  I have a tool where a user can submit "pre-checkin" code to be built, like a try server for Hudson.  So, the recipient name can change every build.  But I just can't think of a way to make that happen.

  13. How do I insert newlines into the Default Content field? I've tried \n /n </p> ?

    Thanks.

    1. I figured it out. With HTML/text formatted emails, <br> works properly.

  14. Unknown User (snemetz@hotmail.com)

    Just started using this and love the features. But it is not created URLs correctly.

    I have the server defined in the the hudson configuration. Other things use it fine. All the variables are correct in the environment.

    But this plugin is returning http://localhost:8080/... for all urls instead of the correct hudson server

    Using Hudson 1.353 and current plugin

    Thanks,

    Steven

    Fixed. Was config issue. Didn't realize the server had to be set in this plugin.

    1. Unknown User (bruce.wobbe@tempo.com)

      I had this problem when I switched servers. My original address was something like this server2.myco.com. I then moved hudson from that server by copying the hold hudson directory over to the new server which was server.myco.com. I then went into the hudson config and changed the server. However each email still had the old server address. I double and triple verified I made the change and restarted hudson, all kinds of things, still the wrong address. Finally I grep'ed for the wrong address and found it in the email-ext config file and changed it there. It then worked. I suspect it reads this address when the plugin is installed , then never again, so if you change the hudson server address , it never recognizes the change and never updates it's config.

      Hope this helps

  15. Unknown User (deepak.chavan)

    i am unable to get mails from hudson, got below error -----------

    Email was triggered for: Failure

    Sending email for trigger: Failure

    Failed to create e-mail address for Sending email to: buildmaster@ebix.com devteam@premiertechnologygroup.com

    ERROR: Could not send email as a part of the post-build publishers.

    javax.mail.SendFailedException: Invalid Addresses;

    nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

    at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)

    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)

    at javax.mail.Transport.send0(Transport.java:169)

    at javax.mail.Transport.send(Transport.java:98)

    at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:234)

    at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:219)

    at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:180)

    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)

    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)

    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)

    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)

    at hudson.model.Build$RunnerImpl.cleanUp(Build.java:158)

    at hudson.model.Run.run(Run.java:1285)

    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)

    at hudson.model.ResourceController.execute(ResourceController.java:88)

    at hudson.model.Executor.run(Executor.java:122)

    Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay

    at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1047)

    ... 15 more Finished: FAILURE

    1. Unknown User (bruce.wobbe@tempo.com)

      This may be a similar problem to what I had. The standard email report uses a space separated list. email-ext uses a comma separated list. I saw a similar error to this when I had them both set up and used the same format(Comma separated ) for both.

  16. I'm convinced that I've run into a rather simple bug with the email mechanisms:

    I have a project where I've only configured "Success" and "Failure" every night. According to the help texts, I should never see any other types of email. However, I still get emails about "Still Failing!", which threw me off since I'd set my inbox rules to look for "Failure!". I don't believe there's a way to work around the issue.

  17. Unknown User (tracyrdavis)

    I am running Hudson 1.358 under Apache/Tomcat on Redhat 5.2 (Tikanga).   I have setup Email to log broken builds including:

    Upon testing email I receive:  Failed to send out email

    javax.mail.NoSuchProvider.Exception: smtp

    Sendmail does work on this box.

    Do I need to configure the /var/lib/tomcat5/.../server.xml file to include a SMTP server to correct ?

  18. Unknown User (bruce.wobbe@tempo.com)

    I have this set up and working great, however the only problem I have is where does the plugin get the email addresses? I have one user who has no email address and I don't know where to put it in? I am using ldap with subversion.  I have email-ext set up to send out to culprits on failure. It works for the one user for which is says no email set up for user xxxx Does it use ldap or subversion to get the email address? I don't see where we have emails assigned under subversion so I am guessing ldap, however I don't know where to assign the addresses for that. If you can let me know how the plugin ddetermines email address in this scenario I'll look further, right now I haven't figured it out yet.

    1. Unknown User (snemetz@hotmail.com)

      It uses the user names from the revision control system. I'm using perforce and it gets the entire email addresses from it. I believe if the version control only has a user name, it takes it and tacks on the domain that you put in the plugin config

  19. Unknown User (tim.voet@gmail.com)

    I didn't see a feature request page, or a roadmap, but i would like to request a feature, to have a token for REPOSITORY URL, we have SVN_REVISION, but i would like the url as well.

    we have jobs setup that are similar with only the SVN URL changing. i would like to automatically include the SVN url in the emails, so that people can quickly know what version has just been deployed.

  20. Hi, I would like to use Java-properties in the Mails. Is it already possible or can you implement that?

    Thanks!

  21. Unknown User (adama@atena.pl)

    Hi, in version 2.2 there was a checkbox "this mail is a script" and "this mail is html". Now there is a select with "plain text" or "text\html". Does this mean that groovy scripts in mails are no longer supported?

  22. Unknown User (brian.ketterer@sabre.com)

    Hey,

    Could we get a release date, or could you make a release of 2.6. I am excited to use the ${BUILD_LOG_REGEX feature and would like it to be available now or at least get a rough idea about when it will be available.

    Thanks

  23. Unknown User (isxylands@gmail.com)

    how use BUILD_LOG_REGEX to filter ant build file execute and result in build log?
    my build has several ant file, and i use this:

    ${BUILD_LOG_REGEX, regex="(?i)\b(Buildfile|BUILD|FAILED)\b", linesAfter=1}
    

    but this only generate the "...truncated XXX lines..." content.

    1. Unknown User (isxylands@gmail.com)

      i see. it is necessary to escape backslash('\'). so it is:

      ${BUILD_LOG_REGEX, regex="\\b(Buildfile|BUILD)\\b", linesAfter=1}
      
  24. Hi,

    Is it supposed to work with the LDAP plugin to retrieve emails of committers from an external LDAP ?
    http://wiki.jenkins-ci.org/display/HUDSON/LDAP+Email+Plugin

    Thx?

  25. Unknown User (crasierwind@gmail.com)

    Hi,

      How can I use a special file content as the email content ?  Just like Ant Mail Task ,Attribute messagefile

     

    messagefile

    File to send as the body of the email. Property values in the file will be expanded.

     Thx !

  26. Unknown User (marco.cc.chan@gmail.com)

    I am trying to modify/set a environment variable within the shell script so that it will be available through the tokens by calling

    ${ENV,var="ABC"}

    How can I do this?

    Thanks!

  27. Unknown User (jamesmcenery)

    According to the version history (2.6), the following is now possible: "Recipient list can now use parameters".

    However there no instructions as to what to enter into the "Global Recipient List" text field. I have tried using the syntax...

    ${ENV, var="EMAIL_ADDRESS_PARAM"}

    ... but this does not work. This results in the following error:

    Sending email to: ${ENV <var="EMAIL_ADDRESS_PARAM"}>
    ERROR: Could not send email as a part of the post-build publishers.
    javax.mail.SendFailedException: Invalid Addresses;
      nested exception is:
    	com.sun.mail.smtp.SMTPAddressFailedException: 501 <${ENV>: recipient address must contain a domain
    ;
      nested exception is:
    	com.sun.mail.smtp.SMTPAddressFailedException: 501 <var="EMAIL_ADDRESS_PARAM"}>: "@" or "." expected after "var="
    ;
      nested exception is:
    	com.sun.mail.smtp.SMTPAddressFailedException: 501 <var="EMAIL_ADDRESS_PARAM"}>: "@" or "." expected after "var="
    
  28. I am having the same problem. Could someone provide further detail to what "Recipient list can now use parameters" means exactly and instruction on how to implement this enhancement?

    1. Unknown User (lars)

      Hi I'm using it in a paremeterized build where the User has to select a "responsible person" for the parameter VERANTWORTLICHER.

      Just adding $VERANTWORTLICHER@randomdomain.de works just fine for my builds.

      1. thanks for your help on that. Seems to be working fine. Although it would be excellent to be able to use a distributionlists or a set of users/groups instead of a single user. Such as 'fullBuildEmailListing = TeamA@gmail.com, TeamB@gmail.com, TeamC@gmail.com.

  29. Unknown User (noski)

    If there's a build error, would it possible to configure hudson to binary chop between the P4 checkins that occurred since the previous build rather than alerting everyone that checked something in between builds? I do have commiters checked for failing and , and this causes it to email all who commited since the last failure, but since the tests take half an hour to run, im polling each hour for changes.

    The main problem is when there are back-to-back unit tests that break, I'd want to be able to make it isolate what exactly broke, and email the proper commiters intelligently.  Has someone already set something like this up?

  30. I am using the HPI referenced in http://techkriti.wordpress.com/2008/08/30/using-groovy-with-hudson-to-send-rich-text-email/ and it is working well.  However the actual plug in has been updated with many valuable tokens I need to make use of.   Any idea how I can update to latest Plug in and still take advantage of Groovy script?  Thanks for any info.

  31. Unknown User (juuso_ohtonen@hotmail.com)

    The feature BUILD_LOG_REGEX seems very useful. I would like to use it to parse email addresses from the console output. However, it seems that BUILD_LOG_REGEX does NOT evaluate properly in the "Global Recipient List" field. Using it in other fields is working fine. I'm using version 2.9 of the plugin.

    Could you improve this feature so it could be used in the "Global Recipient List" field as well?

  32. Unknown User (pauljandrew@gmail.com)

    As above, BUILD_LOG_REGEX works great so it would be good to have it available for generating the e-mail recipients as well. Even if it was just possible to access environment variables as well as build parameters in the e-mail recipient list, it would be a real help. I'm hoping I'll get some time myself to look into trying this.

  33. Unknown User (laurent.delcambre@telegraph.co.uk)

    Hi,
    1) I would like to edit the HTML Jelly template ie. display successful tests. I don't know where to find the list of possible functions to use in Jelly template.
    2) I would like to display Test coverage for each tested method but the only place I coudl find test coverage in my JUnit XML report is in the <system-out>. Is that a normal Junit issue? It sounds weird as it's one of the main purpose of JUnit..
    3) How do you display <system-out> ?

    Cheers,
    Laurent

  34. Unknown User (fordm@finra.org)

    Would like to create/update the html template and add clover and maybe some other stuff.  I see that others have posted similar statements and are requesting documentation on writing the jelly code to do this.  The existing template contains code for including junit and cobertura results, how do we add clover results to the email?  Is there documentation on accessing this information?  An earlier post asked about converting the groovy stuff (which we are currently using) to jelly to use with the new updated plugin.  The lack of responses is disconcerting.  I am not a developer, so requiring me to download source to figure out what to include in the jelly html template is not feasible. Has anyone using this new plugin added clover results to the email template?  How do we find out what data/properties can be accessed from the jelly template?

  35. Unknown User (solganik@gmail.com)

    I have added Matrix build support to email
    ext, and i`m wondering whether you`ll be interested to add it to the
    distribution. I just dont know what is the procedure here with hudson
    plugins (how can i propose a feature).
    I needed that feature for my project, and i have seen a couple of posts
    of people that were interested with such feature, so i have implemented
    it based on 2.10-SNAPSHOT version of the plugin.
    I have added an option to send email only for parent (MatrixBuild) or
    for Configuration (MatrixRun) or both.

    http://wiki.jenkins-ci.org/download/attachments/3604514/patch.txt.zip

  36. Unknown User (nonstop)

    Hello Guys,

    I need email plugin with files attachment support. Could you please tell me when are you going to release 2.10 version?

    Thanks,

       Alexander

    1. E F

      I found the templates in the installed version:

      .jenkins\plugins\email-ext\WEB-INF\classes\hudson\plugins\emailext\templates

      I took the template that I wanted to mess with and put it in .jenkins/email-templates (this is where they tell you to put any custom templates) with a new name.

  37. Hi,

    I'm on Jenkins 1.398 build and when I click on "Advanced" to setup the triggers, I only get the SMTP authentication settings to show up.  I can't find the triggers for mail-ext in the "Manage Jenkins" page.

    1. E F

      From what I can tell, you cannot setup the additional triggers in the overall "Manage Jenkins" section.  I also don't believe that there are any advanced options for Email-ext in "Manage Jenkins".  My guess is that you are looking at the Advanced options for "E-mail Notification" and not "Extended E-mail Notification".

      To setup additional triggers, try going to the configuration for a specific job and look for the "Advanced" button for "Editable Email Notification" under the "Post-build Actions" section.

  38. Has this plugin in the "jenkins" side been stuck on 2.14 for a long time. The "hudson" counterpart states 2.9.

    Anyone knows if this is going to get updates here anymore ?

    1. 2.14 is higher than 2.9 in revision numbers (14 > 9). I think 2.15 should probably come out soon, but it's up to the maintainer.

      1. My bad for temporary loss of math skills :P

  39. I'm unable to get the token FILE to work. I have something like

    ${FILE,build.cs}
    

    Where build.cs is visible on the root of workspace. In the mail received it just shows the same as above without evaluating the token and including its content in the mail.

    1. Are you sure there is no space between the comma and the name of the file? I've found the tokenizer to be a bit picky on stuff like that.

      1. I've tried with both (space and no space). I've opened a issue for this JENKINS-9825

        1. This format works:${FILE, path="info.log"}

  40. Is it possible to use an "in-reply-to" option? If yes, where and how can i configure this?

    I already searched the whole internet to get this information, with no success... :-(

  41. Hi,

    I use a custom jelly script to generate the emails, and I would like to add statistical information such as that displayed in the plugins Violations PluginWarnings Plugin and Task Scanner Plugin

    I have updated the template by using sections from the scripts supplied with the various plugins, but I can't seem to get access to the data to display. I've attempted to make guesses by looking at other parts of the supplied scripts (eg, ${it.violations} which is similar to ${it.JUnitTestResult}), but so far I've had no success. Can someone please show me how to locate and use this data?

    Thanks.

    1. I have the same problem. did you find the solution?  If so can you please share it with me. Thanks in advance.

      1. Not yet sorry. When I get the chance I'll take a look at the source, but unfortunately I don't think that's going to be anytime soon. :(

  42. Hi,

    is there a way to get a link to a broken test within the jelly definition? I tried many ways, but i couldnt find any solution. 

    Failed: ${failed_test.getFullName()}
    
    should be a link ala:
    
    Failed: <A href="${rooturl}${build.url}/${failed_test.getUrl()}">${failed_test.getFullName()}</A>
    
  43. I am trying to update the template to include this basic logic (psuedo-code):

    IF FileExists("Artifacts/Messages_Errors.log") THEN

        DisplayFileContents("Artifacts/Messages_Errors.Log");

    ENDIF

    The Jelly code would be based on this:

    <j:if test="my if statement above">
    <TABLE width="100%" cellpadding="0" cellspacing="0">
    <TR><TD><B>BUILD ERRORS</B></TD></TR>
    <TR><TD>(file contents from above)</TD></TR>
    </TABLE>
    <BR/>
    </j:if>

  44. I am trying to use the BUILD_LOG_REGEXP and it works quite fine. thanks.
    But I still have a problem with multiline regexp.

    Let's consider a console output with something like :
    Start Line
    Line 1
    Line 2
    Line 3
    End Line

    I would like to have all lines between Start and End lines
    the regexp I tried is :
    ${BUILD_LOG_REGEX,
    regex="(?m)Start Line.*End Line",
    linesBefore=0,
    linesAfter=0,
    maxMatches=1,
    showTruncatedLines=false
    }

    I put it there on several lines for clarity.
    This does not work at all.

    Where can I have made a mistake ?
    Please, any information will be appreciate.

    Thanks for your help.
    J-L

      1. Exclude borders approach!

        BUILD_LOG_MULTILINE_REGEX

        For a HTML template.

        Be aware of double backslashes!

        <pre>
        ${BUILD_LOG_MULTILINE_REGEX, regex="(?s)(?<=some your \\. text).*(?=some \\[other\\] text)", showTruncatedLines=true}
        </pre> 

         

         

  45. Would it be possible to add a trigger/condition to send emails on release builds?

    Thanks in advance!

    1. All requests for features should go through http://issues.jenkins-ci.org

  46. Please, could you tell us uf it is possible to configure multiline patterns when using BUILD_LOG_REGEX.
    I have tried several solutions around :

    regex="(?m)Start .*End"
    

    But with no success.

    Thanks for your help

    1. Search my example above by searching by BUILD_LOG_MULTILINE_REGEX

      1. Hi Tretyakov,

        I have tried with BUILD_LOG_MUTILINI_REGEX syntax which you have mentioned but no luck.

        My code:

        <table>
        <tr><th>Project Name:</th><td>$JOB_NAME</td></tr>
        <tr><th>Build Number:</th><td>$BUILD_NUMBER</td></tr>
        <tr><th>Build URL:</th><td>$BUILD_URL</td></tr>
        <tr><th>Jenkins Console Output:</th><td><pre>${BUILD_LOG_MULTILINE_REGEX, regex="(?s)(?<=some your \\. text).*(?=some \\[other\\] text)", showTruncatedLines=true}
        </pre>
        </td></tr>
        </table>

         

        Could you please help me on this...

         

        Thank you!!!

         

        Regards,


        Santhosh

         

        1. Hi, I don't understand you, Santhosh.

          Try the following.

          Copy an entire log from any build.

          Go to any "online RegEx site" and debug you RegEx against the log.

          Don't forget to replace double slashes with single.

           

  47. Since upgrading to Jenkins 1.430 and email-ext 2.15, Jenkins is sending "Successful!" emails for projects that have the "Success" trigger disabled.

    This issue is also reported here:

    http://groups.google.com/group/jenkinsci-users/browse_thread/thread/74885c57102ad8ed#

    Can this be fixed by downgrading the plugin to 2.14.1?

    Is this bug known about?

    Thanks in advance.

  48. How do I e-mail someone only if the regex matches something in the log? The e-mail should not be sent otherwise.

    1. This is not currently possible, though I am planning on adding a pre-send groovy script capability, the result of which will be a boolean to say whether to continue sending or not, so this may be one way of doing this in the future.

  49. hey,

    I wanted to expose a BUILD_USER ( user that initiated the build )variable to the email notification.

    As i couldnt find any variable that helps me display this. I used the M2 extra steps to initiate a pre build shell script :

    export BUILD_USER="`head -1 $WORKSPACE/../builds/$BUILD_NUMBER/log \| awk '{ print $2, $3, $4 }'`"
    

    and use this in the mail, but it doesnt show up in the ENV variables when i send out

    ${ENV,var=""};
    

    any help ???

    1. I assume you are really doing

      ${ENV,var="BUILD_USER"}
  50. Great work with this plug-in.

    It would be nice to also have default triggers available, configured at the Jenkins level, so I don't have to set them on every project.

    Thanks,

    Ed

  51. Hi,

    Having trouble getting the "Send to Requester" to work.  When I select it the job says it sent something, but the err log shows this exception:

    SEVERE: Executor threw an exception
    java.lang.NoClassDefFoundError: hudson/model/Cause$UserIdCause
            at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:333)
            at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:235)
            at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:227)
            at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:189)
            at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
            at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:649)
            at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:625)
            at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:603)
            at hudson.model.Build$RunnerImpl.cleanUp(Build.java:170)
            at hudson.model.Run.run(Run.java:1405)
            at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
            at hudson.model.ResourceController.execute(ResourceController.java:88)
            at hudson.model.Executor.run(Executor.java:145)

    We are really interested in this functionality, so any help is appreciated.  We are running Jenkins ver. 1.409.2

    Thanks!

    1. I think this should be fixed in a recent version, if not, please file an issue at http://issues.jenkins-ci.org

  52. Has anyone ever run into this problem?

    Go into the Jenkins global configuration settings, then in Editable Email Notifications, you set the Default Recipients to one or more email addresses. You save the settings then go back to the same page to check the values. But, the value you had just saved as Default Recipients was not saved properly and the value is now blank.

    Now, when I have a project attempt to send an email notification to ${DEFAULT_RECIPIENTS}, there is an error message printed out in the console and the email is unable to be sent.

    Any suggestions?

    1. There's a bug in version 2.16. You can work around it by downgrading the plugin to version 2.15. That works fine for me.

  53. Does the latest version really depend on Jenkins core 1.428? We are planning on upgrading to LTS 1.424.1, but will not get to 1.428 for a while.

  54. What are the changes in 2.18?

  55. Hi,

       Can somebody kindly give a sample of the matching pattern for attachment? Because I tried different ones such as '.bz2', <include name='.bz2> and 'folder/right/below/workspace/*.bz2' and none of them work for me. And I could only get email without any attachment.

       Thanks!!!! 

  56. Is there any way to get the full commit-message instead of just the subject line into the email?

    I'm using something Like:

     ${CHANGES, showPaths=true, format="[%a] http://CGIT_URL/commit/?id=%r\n%m%p\n"}

    (with CGIT_URL filled in to route to my server).

    Perhaps you could add something like %M for the full message or %b for message body?

    I'd create this as an enhancement request issue, but I want to verify that I haven't missed something obvious.

    Thanks,

  57. I am trying to leverage the email-ext plugin to only send out emails when a job job is triggered by a timer. My goal is to have emails sent from our nightly runs, but not sent when a build is manually triggered by a user. 

    I am currently using a groovy script to populate the body of my email. Is there any way to have the script either cancel the sending of the email, or dynamically configure the recipient list based on information from the build?

  58. I encounter a problem i don'k know to overcome...
    I'm  kind of new in jelly, so i'm stack for a day (!!!) don't know how progress.
     i'm trying to use jelly:util tag, and I get null Exception.
     please help!!!

    I'm trying to check if some image-uri exist, and if so - add it to email:
    a short version of what i tried:

    <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:util="jelly:util">

    ....
    <util:available uri="some-uri">
                   
     </util:available>

    It took me a while to understand the problem is that I don't have util.jar so i downloaded it (commons-jelly-tags-util-1.1.1.jar) and try to place it in several locations:

    (of course i restarted jenkins afterwards...)

    • %JENKINS_HOME%\plugins\email-ext\WEB-INF\lib (created the directory lib)
    • %JENKINS_HOME%\war\WEB-INF\lib
    • %JENKINS_HOME%\email-templates

    still - dont work :(

    please help me - what am i doing wrong?

  59. I have multiple projects in our CI server and each project is configured to send broken builds to that projects PM (which changes per project) as well as the user who committed the broken build.  What I need to do is also add the Programming Director email to all broken build notifications that go out.  Is this something I can leverage with this plugin without having to touch every project?  It looks like I should be able to set a default recipient for the plugin and then in each project append the different PMs to this list in the "Project Recipient List" field.

    ...am I correct?

  60. the field Recipient List for triggers is getting erased after update...

  61. How I can set language for emails? I want to set languadge to 'En', my browser has locale Ru-ru, so I get letter with Russian localization, how to set to English?

  62. Hi,

    I can't use the plugin, when I select the option "Editable Email Notification" in the  "Post-build Actions" nothing hapenned. 

    I'm using Jenkins v1.463 and Jenkins Email Extension Plugin v2.20. 

    Thanks in advance,

    Juanma

    EDIT: I found the issue https://issues.jenkins-ci.org/browse/JENKINS-13737

    1. I'm having the same issue. I'm new to this plugin - while I wait for them to fix it in Jenkins/Email-ext, can someone paste the snippet of xml in your job definition that enables Editable Email Notification, so I can manually enable a job?

      1. slide checked in a work-around into Email-ext's source on github. 

        https://github.com/jenkinsci/email-ext-plugin/commit/ee715fbd1bd81e83cb9501c311fd04f309431a2c

        Who can trigger a build?

        1. I already made a new release (2.21)

  63. After the build I want to trigger two e-mails. The first one is a mail to sharepoint server. Sharepoint uploads its attachements. The subject of this mail must matches sharepoint folder for uploading.

    The second one is a mail for team. So, it should have nice subject rather than folder name :)

    But now I can configure one Success trigger only. It would be nice if I can configure two or more Success triggers.

    Is it possible to implement?

  64. It would be nice if I could config the from: field of the address. Especially when you have multiple project in one jenkins instance and you would be able to specify the different sender address for different projects

  65. h m

    Have a problem triggering a success mail to the committer for a downstream project.  The plugin complained 'An attempt to send an e-mail to empty list of recipients, ignored.'

    A success mail was sent ok to the committer for the upstream project. 

    I did not do anything special for the mail settings except chking the chkbox for 'Send to committers' in the Advanced settings and setting the 'success' trigger for both projects.

    <Upstream project>

    ...
    new build or checkin detected - <proj name>
    Email was triggered for: Success
    Sending email for trigger: Success
    Sending email to: <committer email addr>
    Triggering a new build of <downstream proj> #62
    Finished: SUCCESS

    <Downstream project>

    ...
    Email was triggered for: Success
    Sending email for trigger: Success
    An attempt to send an e-mail to empty list of recipients, ignored.
    Finished: SUCCESS

  66. I've been trying to get environment variables to work with Email-Ext for a while now, and I've finally found that all the syntax information I have looked up is wrong

    The proper syntax for Environment variables, where the variable name is $SOURCE_BUILD_NUM would be $'

    Unknown macro: {'ENV, var="$SOURCE_BUILD_NUM"}

     
    The full variable must be placed in the quotes. 
    All other help documentation I've seen suggests that the variable name with the "$" should be put in the quotes. 
    I hope this helps future users :)

  67. who can help me? I have configured the smtp server. and can sent mail via the basic notify.but ,when I use the email-ext, I can't get mail of the build result. my trigger is before build.

    there is no error in log, How can i receive the mail?

  68. is there any way to attach the file or contents of the file, that is not in the workspace. I tried realative paths, but that doesnt seem to work.

    1. No, this is mainly for security reasons.

  69. Is it possible to globally configure triggers instead of doing it individually for each project? For example, I want a trigger for every Unstable build. But I want it to be default for every project.

    1. No, this is not possible.

  70. Is there a way to use a Groovy template that is uploaded using "Config File Management".

    1. I have no idea what "Config File Management" is, so I'll have to say "no". The templates must reside in the email-templates directory. If you can explain more what you are looking for, feel free to file an enhancement request with all the pertinent information.

  71. Does the current implementation of "Regression" and "Improvement" look to TestNG results to determine the more / less failures?

    1. I don't think the TestNG plugin implements the correct interfaces/classes to be treated like normal test failures, so I believe the answer is no. The TestNG plugin would need to be updated to do this.

  72. Is there any way to add a pre SCM trigger?

    1. Please file an enhancement request in JIRA

  73. I'm building a project with multiple SVN repositories.

    When I use the token $ 

    Unknown macro: {SVN_REVISION}

     all I get is the number 400, which isn't the build number nor any of the repositories' revision number. 

    What I want to use is the same variable the svn plugin provides: %SVN_REVISION_1%, but neither $ 

    Unknown macro: {ENV, var="SVN_REVISION_1"}

    nor  $ 

    Unknown macro: {ENV, var="%SVN_REVISION_1%"}

    work.

    Also, when I list the variables ($ 

    Unknown macro: {ENV, var=""}

     ) I can't find SVN_REVISION or SVN_REVISION_1.

    The email needs to have SVN_REVISION_1 on the subject, or else it'll be quite a hassle to find what version was built. 

    Are there any workarounds?

    1. 400 is what is being put in by the email-ext plugin if it can't find the SVN_REVISION env variable value. So, even in the Java code, SVN_REVISION is not available for some reason. Environment variables don't need to have % around them at all when used with the ENV token. Please paste a build log in the JIRA item.

  74. I like the idea of being able to send build logs, and I can configure it for the generic default. However the configuration won't take for the triggers.   I can select the option to include the build log and save it, but it always saves a false value to the xml file.  I've tried modifying the xml by hand to true and it will come up in config as selected, but if I click on save (without making any changes to the config) it will revert to false.   I've tried shutting down and restarting jenkins, both after modifying the value with the config screen and after modifying the xml manually.   This is a consistent behavior that acts is if its hardcoded on save to be false.

    We are running Jenkins 1.500 with Email-Ext 1.25, Maven-Integration 1.500, Token Macro 1.5.1, javadoc 1.0, analysis-core 1.48.

    1. Please file issues at http://issues.jenkins-ci.org and select email-ext as the component.

      1. This should be fixed in the next version.

  75. Is there any way to get

    ${ENV, var="MY_VAR"}

    into the groovy template? I have developed a plugin that generates some URL as String which I am setting as an environment variable. I need to access this environment variable in my groovy email template.

    1. You could do something like this (after importing the correct stuff):

      def content = new EnvContent()
      def args = ["var" : "YOUR_VAR"]
      def envVar = content.getContent(build, null, null, args)
      

      I have not tested this, but it should work

    2. I've filed [1] to track adding an easier way to do this.

      1 - https://issues.jenkins-ci.org/browse/JENKINS-16916

      1. FYI, I fixed this. You should be able to do things like ${ENV(var: "BUILD_ID")} in the groovy template in the next version.

        1. Thanks for your quick response on this Alex. What would be the tentative date for the next release?

          1. I'm doing some final testing now and should hopefully release by the end of the week.

  76. doesn't seem to work for me, created an issue https://issues.jenkins-ci.org/browse/JENKINS-16917&nbsp;

    Status Code: 500

    Exception: java.lang.ClassCastException: hudson.plugins.downstream_ext.DownstreamTrigger cannot be cast to hudson.tasks.BuildTrigger
    Stacktrace:
    javax.servlet.ServletException: java.lang.ClassCastException: hudson.plugins.downstream_ext.DownstreamTrigger cannot be cast to hudson.tasks.BuildTrigger
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:615)

    1. Did you mean to put this onto a different wiki page? Looks like you are referring to downstream-ext, not email-ext.

  77. After some upgrade (I don't know exact version) we have next problem: each email sent by email-ext plugin is just

    Error in script or template: groovy.lang.MissingPropertyException: No such property: host for class: Script1 
    

    How can we fix this issue? No changes in email-ext templates, no changes in other stuff - just upgrading Jenkins itself.

    I searched for all googleland but no helpful articles there ((

    Thank you!

    1. You only upgraded Jenkins and started seeing this issue, or you upgraded email-ext and started seeing this issue? Please use the mailing list for general questions as I generally don't check this page. Also, if you find issues, please use JIRA https://issues.jenkins-ci.org.

  78. I'm using a Script Trigger. I noticed that build exists as an object, but logger doesn't. I tried a few other things I've found on SO to get output to the console logs but to no avail. Is there a way to get println to the console log?

    Also, i was wondering if there is a way for the Pre Send script to know which trigger it is processing? I'm guessing only the pre send script has the msg object.

    Thanks!

    1. You're right, there isn't anyway currently to log, can you open a JIRA for that? For the pre-send script thing, I added trigger (current trigger) and triggered (all triggers that were triggered) to the object model, see https://issues.jenkins-ci.org/browse/JENKINS-17577. Also, just for reference, if you could use the Jenkins user mailing list for questions, that would be preferred. It was luck that I checked the wiki today.

  79. I'm trying to write a small groovy script to replace newlines \r and/or \n with break tags.

    I can get the mail body using msg.content, but that is a byte[] array. How can I decode the byte array to a String, en after calling myString.replaceAll(~/\n/, "<br/>"), encode the String again? 

    1. Please use the mailing list for questions.

      1. Ok, I will (in the future).

        I found a solution myself. It only focuses on the first body part, but it suits me:

        content = (String)msg.getContent().getBodyPart(0).getContent()
        content = content.replaceAll(~/this/, "that")
        msg.setText(content)
        msg.saveChanges() 
        
  80. I faced the problem with multi-configuration job and Email-ext plugin. My job runs on two different PCs (only Windows OS) in parallel, and I need after job finished send an e-mail notification just for parent job. I've tryed to configure post-build action - Editable email notification to set property 'Trigger for matrix projects' = Trigger only the parent job. But after applying, saving and reopening job configuration, 'Trigger for matrix projects' = Trigger for parent and each configuration, so I sent 3 notifications except one. 

    I'm using last Jenkins build (1.528) and Email-ext plugin with version 2.32

    Please suggest how to fix this?

  81. Hi trying to set ENV variable inside  $

    Unknown macro: {FILE, path}

    as part of sending mail.

    1. What is the correct way to use ENV variable as part of the path When path is /Carmel-Versions/*$

    Unknown macro: {ENV, var="NAME"}

    */foo.log  and NAME is ENV variable ?

    2. When I tried to execute in the following:

    ${$

    Unknown macro: {FILE}

    , path="/Carmel-Versions/*$

    */foo.log"}

    I receive:

    ${[[ Exception while replacing FILE. Please report this as a bug. ]] {{ java.lang.IllegalArgumentException: FILE token requires the path parameter }}, path="/Carmel-Versions/TEMP/foo.log"}

    1. Please use the mailing list for questions. You can't nest tokens inside of each other. If you want something like that, switch to using Groovy templates and you can do much more there.

  82. The Email triggered by before build does not send email to the requester if the build is started via Jenkins CLI.

    Our Jenkins is running version 1.455 and Email-ext plug-in version 2.20.

    Can this be confirmed as bug?   The email was sent before build correctly to requester when the build is started from Jenkins GUI.

    Thanks.

    -Indra

    1. Your version is very old, so unless you can see the same thing on something newer, I probably won't look into it. also, email-ext just gets the requester from the build, so it would be a bug in Jenkins core, not email-ext.

      1. Thank you for your prompt reply!

        I found the bug in the core/CLI:

        https://issues.jenkins-ci.org/browse/JENKINS-14393

        I have came up with solution using groovy script that gets executed by means of:

        in the job configuration, in the recipients list, I put ${SCRIPT, template="build-requester.template"} when set to pre-build trigger's recipient list field.

        -Indra

  83. Is there a plan to add more triggers as default not only "Failure".  I want to set additional triggers that will be default for all jobs in the Jenkins global configuration page.

    Triggers

    By default, the only trigger configured is the "Failure" trigger.  To add more triggers, select one from the dropdown, and it will be added to the list.

    Thanks.

    -Indra

    1. In the future please use the Jenkins User mailing list for questions. No, there is not currently any plan to add more triggers to the default list.

  84. Hello! When do you plan the next release? This is the highly anticipated feature.

  85. How to configure Email -Ext for sending email before build starts?

    1. Try to add a new trigger via 'Advanced' button in the menu of the email-ext plugin in the post build section of a project. The triggers name is 'Before-Build'.

  86. I have tried to get the "html_gmail" Jelly template to correctly show nice HTML in my Gmail account, however I only get the raw HTML showing up. (see below)

    I uploaded the "html_gmail.jelly" template from https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/resources/hudson/plugins/emailext/templates/html_gmail.jelly to the correct spot on my Jenkins server, and verified that it rendered in the Email Template testing section.  But it still isn't getting recognized as html content by Gmail.

    Can anybody see what I'm missing?

    1. Did you set the content type to HTML?

  87. Does anyone know if it is possible to configure the "editable email notification" to:

    send an email when a job status changes from FAIL or UNSTABLE to SUCCESS, but not when the job status changes from UNSTABLE or SUCCESS to SUCCESS

    1. Just as an FYI, it is best to use the mailing list for questions about the plugin. 

      You can create any logic you want using the Script Trigger. See the documentation for more information.

  88. Does anyone know how to set the recipient list based on the branch failing ?

    Like, by default, i want to send email to the developers on failure but if the branch was master, i want to send it also to "team@work.com"

    Thanks

  89. Hello, I've a problem using Default Pre-send Script, it is configured as:

    ${SCRIPT, script="pre-send.groovy"}

    The script contains following line:

    msg.setRecipients(javax.mail.Message.RecipientType.TO, recipientWhenConfigurationProblem);

    But I've got following exception:

    Script1.groovy: 1: expecting EOF, found 'or' @ line 1, column 17.
    Error in script or template: groovy.lang.MissingPropertyException: No such property: msg for class: Script1
    

    While putting the entire script in "Default Pre-send Script" text area the problem is gone, but this is not the solution, I'd like to have this script as external resource.

    Is this some issue within the plugin or my mistake ?

    1. In the future please use the Jenkins User mailing list for questions. https://groups.google.com/forum/#\!forum/jenkinsci-users

      You need to put the code for the groovy script directly into the edit box, you can't use content tokens for the presend script.

      1. Hi, OK, thanks for quick response, I'll use this mailing list in the future :)

        So there is no way to use an external script here ?

        1. That's correct, there is no way to use an external script.

  90. Hello,

    I was wondering is there a wat with the Pre-send script to send different mails if there is a requestor or not.

    currently if there is no requestor I am only sending to mailing list and if there a requestor to both requestor and mailing list.

    is there a if ( requestor)

    send requestor

    else

    send mailing list

    many thanks

  91. Since a few weeks the replacement of macros in sent email doesn't work any more. For example, email subjects now read

    $PROJECT_NAME - Build # 408 - $BUILD_STATUS!

    Any ideas what the problem could be?

    1. Even we are facing the same issue. The only way it is working is replacing the $PROJECT_NAME to $JOB_NAME and removing the $BUILD_STATUS completely and have values like FAILURE , FIXED and SUCCESS instead of $BUILD_STATUS. Ex: $JOB_NAME - Build # $BUILD_NUMBER - FAILURE. This is for trigger Failure.

  92. Hi,

    I want to use Email-ext in a pipline groovy script. My question is how I can send the mail to developers and Culprits. Is there a variable I can set in the Project Recipient List?

    thanks!

  93. Hi,

    I want to use Email-ext in a pipeline groovy script. My question is how I can send the mail to developers and Culprits. Is there a variable I can set in the Project Recipient List?

    thanks!

  94. Hi, Anyone have any idea why "Editable Email Notification" checkbox is not visible in Jenkins in the  "Post-build Actions" section? For some unknown reason this option seems to have disappeared from all of our projects. We have tried to reinstall the plugin but no luck!

  95. In Jenkins 2.2 with the current (2.42) version of the plugin and mostly default configuration, I have one email address in system configuation and $DEFAULT_RECIPIENTS in my project and my build log ends:

    Email was triggered for: Failure - Any
    Sending email for trigger: Failure - Any
    An attempt to send an e-mail to empty list of recipients, ignored.

    This would seem to be https://issues.jenkins-ci.org/browse/JENKINS-13583 but that is marked as resolved four years ago. Any thoughts?

    1. BTW, I get email if I use the built-in basic notification so the problem seems to be in the plugin.

  96. Does the plugin support email distribution list? Instead of giving individual email id can i enter distribution list?

  97. Hey,

    since 2.43 templates can be accessed from the workspace. How does it works since the documentation is not updated until today?

    Is it just $

    Unknown macro: {SCRIPT, template="groovy-text.template"}

    and the plugin search then automatically in "$JENKINS_HOME/email-templates" and in the workspace or should I provide an absolute path etc.?

    Thanks for clarification,

    Florian

  98. It would be useful to have a "Test configuration by sending test e-mail" option in the configuration similar to the default email notification configuration.

  99. Is there a configuration way to append a file to contain the email subjects and the receivers, or even the full sent email, so that one could audit trail from a single place what has been happening? I mean, try to find people that received emails that indicate that they broke the build...

    Thanks

    Jorge

  100. Thanks for a great plugin!

    I am sending failures and unstables to different sets of recipients, and I need a way to send the corresponding 'back to normal' emails to the corresponding recipient set. (I need to keep them separate because the recipients don't want to see 'back to normal' email for issues that didn't concern them.) Please add the following separate trigger conditions:

    Failure->Success - this wouldn't send 'back to normal' email when the previous build was in the unstable state   

    Unstable->Success - this would send 'back to normal' email when the previous build had failed

  101. I guess I will never understand these "everything is a plugin" type architectures.  Maybe it is the inherent sloppiness of Java based projects, or the fact that Jenkins has grown - like Emacs - into a great OS without a decent editor.

    I am at a complete loss as to how to find what strikes me as basic information about pre-send scripts.  Yes, I can see the totally trivial examples, but even they don't help me to understand much at all

    if (build.result.toString().equals("FAILURE")) { 
        msg.addHeader("X-Priority", "1 (Highest)"); 
        msg.addHeader("Importance", "High"); 
    }
    cancel = build.result.toString().equals("ABORTED");
    

    Where do those objects come from - are they really global ? What other object instances are available to me ? Where is the damned documentation for this ?

  102. I'm wondering what the best approach to bring the contents of a file into the email body.  We have a file that aggregates information from other downstream projects and want to put this in the email body.

    1. Now this is possible, e.g.

                  def content = '${SCRIPT, template="groovy-html.fixed_JENKINS-38968.template"}'
                  emailext(
                      subject: "${currentBuild.result}: ${env.JOB_NAME} [${env.BUILD_NUMBER}]",
                      to: 'some.one@somewhere.com',
                      recipientProviders: [[$class: 'CulpritsRecipientProvider']],
                      body: content
                  )
      
  103. Jenkins can configure multiple send mail? A job corresponds to a mailbox.

  104. Thanks for implementing  JENKINS-42698 - Getting issue details... STATUS . So now this will also work to print a default value: ${ENV,var="foo", default="foo not set"}

  105. [server timeout duplicate, please ignore, can't delete]

  106. [server timeout duplicate #2, please ignore, can't delete]

  107. Can this plugin be enhanced to do the following:

    I have a job which runs every minute or 2 and sometimes the build fails and the next builds passes. For build failures, I'm using Editable Email Notification plugin in Jenkins.

    Either using this plugin or any other plugin/way, can I somehow configure Jenkins job to send me a failed build notification ONLY if the last 3 consecutive builds have failed? It's no fun to watch these builds fail and then succeed in the next run so I'm trying to reduce the frequency of such failure notifications OR make it more intelligent.

    https://stackoverflow.com/questions/44855143/jenkins-send-email-notification-only-if-last-n-builds-have-failed-not-per-run

  108. How do the recipientprovider behave when the (pipeline)job is triggered by a merge request from gitlab?

    I use a script to detect merge requests (see https://vetlugin.wordpress.com/2017/01/31/guide-jenkins-pipeline-merge-requests/)

    I just want to send notifications to the developer (culprits...) who contributed to the source branch but not the target branch.


  109. Will culprits and suspects include the upstream committers, or only committers to this project?

    When I have 'upstream committers' selected for job B, the upstream committers for job 'A build 1' are included in the email sent on completion of Job 'B build 1', because A triggers B as a downstream job. So far so good.

    Job 'B' is a set of integration tests on a deployed system that 'A' contributed to, and including committers from that build of  'A' is great. But I want to continue having the committers from 'A build 1' be included in the results for subsequent B builds 'B build 2' and 'B build 3' and 'B build n', until there are no tests failing for 'B'. It looks like the FailingTestSuspectsRecipientProvider is designed for this (shows as "suspects causing unit tests to begin failing" in the job configuration), but not sure it works for previous upstream committers (job A), or only previous committers to B's source code.

    1. you are correct you need the combined functionality of both which currently doesn't exist. Feel free to make one and send a pull request

  110. environment {
        SUBSCRIPTION = credentials('subscription')
        CERT = credentials('cert')  
    }

    how to use inside email template env variables defined in declarative pipeline block ?

  111. When I try to have jenkins send email to the "requester" it says there is no requester.

    16:05:56 Sending email for trigger: Success
    16:05:56 An attempt to send an e-mail to empty list of recipients, ignored.

    How can I have Jenkins get the name or email of the user who pushed the changes to our git repo?

    1. you want developer not requester 

    2. Developer maybe, but developer sends it to everyone who's made changes on that branch.  I'm looking to get just the user who made the push that triggered the build.

    3. I know it has the info somewhere because the first line in the console output is:

      23:43:20 Started by GitHub push by markmercer10
      1. Developer sends to all developers that made changes since the last build. So if you do build per commit it will be that user

        1. Thanks! That should work.

  112. Hi, I could not found $BUILD_DURATION in token list in version 2.61 and 2.58, but found in 2.42.
    Did it been removed or hide in somewhere?  

    1. Macros are provided by token-macro plugin

      1. Thanks for reply, Let me ask in token-macro plugin page.

      2. Just got reply from token-macro page:
        It must be coming from another plugin because token-macro hasn't included a BUILD_DURATION macro in any version.

        This parameter BUILD_DURATION might provide by other plugin?

  113. I really like the email domain filtering introduced in this commit: https://github.com/jenkinsci/email-ext-plugin/commit/af272142ceaa25680fd41af3a39e208525bd94e4

     

    When will it be built into a release?

  114. Is there a parameter I can use to display the name of the requester in the email content?

     

    Something like "Build executed by $REQUESTER"

     

    Whether it's first name last name, or display name doesn't matter. Just so that the email recipients know who triggered the build.

  115. Hi, is it possible to prepare the email's content conditionally? For instance, if the build was triggered due to a commit, I'd like it to have one specific piece of text, and if it was triggered manually (i.e., there are no code changes that triggered it), then I'd like it to have an alternative piece of text?
    Thanks.

    1. For me it turns out to learn Groovy. I believe the Email-ext plugin wasn't architected to do this. And this is a pain.

      I don't remember the extension point I have chosen, but Ext-email invokes my Groovy code and it forms an appropriate email message.

      To send many different dynamic messages I use external parameterized projects in the same way.

      Of course the plugin's API & Groovy allow you to suppress mail sending if you will.

  116. Thanks for replying, guys. Any documentation / how-to article available on more detailed steps on how to use a groovy script to form custom email content?

    1. Absolutely no documentation. You have to jump here and there and search everything by you own.

      By the way, I'm doing in the following trick.

      I put my Groovy script to the Jenkins/email-templates folder.

      I invoke in the "Pre-send Script" field of "Editable Email Notification" (post build actio) by calling the following code

      evaluate(new File('./email-templates/my-logic.groovy'))

      1. All you need it is to search Ext-email API. Possibly this page will be enough for this.

        1. Thanks a lot for all the info / hints, Ilya.

          1. You are welcome!

            And use the following script as a jump start with the Ext-email plugin API.

            https://github.com/it3xl/jenkins-ext-email-dynamic-message/blob/master/build-status-change.groovy

            Also use the following Groovy to stop any mailing

            // Stops mail sending.
            // https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin#Email-extplugin-Pre-sendScript
            this.cancel = true

             

             

            1. OMG! It is dangerous to use the setContent API-method in Groovy

              msg.setContent(content, 'text/html')

              You have to cast the content variable to the plain string Java type. A default GString typed variable will not work there (tl;dr)

              1. (smile) Thanks. I should be able to handle the groovy parts, once I see the long, sky-is-falling-style errors it produces.

  117. Hi, I'm receiving connection error while trying to send email triggered by before build. Here is the output log:

    Email was triggered for: Always
    Sending email for trigger: Always
    Sending email to: johnliu95@hotmail.com liujohnl@sfu.ca
    Connection error sending email, retrying once more in 10 seconds...
    
    Connection error sending email, retrying once more in 10 seconds...
    
    Failed after second try sending email

     

    Did anyone encounter the same issue?

    1. Seems like I've forgotten to configure the SMTP properties before using the plugin.

Write a comment…