28

I'm using Jenkins 2.2 and email-ext plugin 2.42 (both current, as are all of the rest of my plugins). I have my global configuration set to have a single, explicit recipient and my project is using default email notification configuration (that is, send to $DEFAULT_RECIPIENTS). I have also set an explicit recipient in the project. In both configurations, the console output for the job says:

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 except 1. that was marked as resolved four years ago, and 2. I get e-mail when I use basic, built-in notifications. Does anyone else see this problem with email-ext?

Chris Nelson
  • 3,519
  • 7
  • 40
  • 51
  • Buried in the docs, there is a `to:` parameter so you can just specify recipient(s) without the bother of figuring out the `recipientProviders` complexities. – MarkHu Apr 19 '18 at 20:05

4 Answers4

52

Turns out plugin configuration is somewhat non-intuitive; a necessary setting is buried behind an Advanced button. I got answers in https://issues.jenkins-ci.org/browse/JENKINS-34731 and it is working now as follows:

In the Advanced settings, Triggers -> Failure - Any lists "Developers" by default, but not "Recipient List."

pergy
  • 5,285
  • 1
  • 22
  • 36
Chris Nelson
  • 3,519
  • 7
  • 40
  • 51
  • Thanks Chris. Can you state the config you are referring to? – Pratik Khadloya Jul 06 '16 at 20:42
  • 8
    In the Advanced settings, Triggers -> Failure - Any lists "Developers" by default, but not "Recipient List." – Chris Nelson Jul 08 '16 at 01:37
  • 2
    Advanced Settings of what, "Extended E-mail Notification"? If its what we are talking about, this answer is probably outdated because there is no setting for Trigger->Failure. – vincedjango Jan 07 '19 at 20:09
  • I can confirm this answer is still true. The advance settings is for Editable Email Notification. – Mansour.M May 01 '20 at 00:03
  • To the people who are confused, there is advanced settings in both the Manage Jenkins page and also, in project configure section of Editable email Notification. You have to remove the developer option and add Recipient list in The advanced section of the email notification of a job – aswathy May 27 '22 at 05:03
4

For those using this plugin in combination with Job DSL. I have do add the sendTo { recipientList() } block explicitly to the different triggers.

So my DSL looked like this:

extendedEmail {
    recipientList('${EMAIL_RECIPIENTS}')
    triggers {
        failure {
            subject('The subject')
            content("The content")
            sendTo {
                recipientList()
            }
        }
    }
}
Pieter Meiresone
  • 1,910
  • 1
  • 22
  • 22
0

Instead of using $DEFAULT_RECIPIENTS use to:

emailext(
    to: 'somename@emailprovider.com',
    body: '${DEFAULT_CONTENT}', 
    mimeType: 'text/html',
    subject: '${DEFAULT_SUBJECT}',
    replyTo: '$DEFAULT_REPLYTO'    
    )
}

Ref: https://stackoverflow.com/a/39499554/1134084

Pankaj Shinde
  • 3,361
  • 2
  • 35
  • 44
0

I finally found the problem through repeated attempts. There is no need for such trouble at all. The reason is that in the advanced Settings of Editable Email Notification trigger condition, the Recipient List is empty by default, and all your Settings outside will be overridden. An attempt to send an e-mail to empty list of recipients was ignored. An attempt to send an E-mail to empty list of recipients ignored. enter image description here

严学文
  • 11
  • 2