Reputation: 3707
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?
Upvotes: 28
Views: 33812
Reputation: 511
I was using a noreplay address for the to field and recipientProviders like culprits for the developers with attached logs and it was working:
emailext to: '[email protected]',
recipientProviders: [culprits()],
subject: 'Jenkins-Build has failure: $PROJECT_NAME - #$BUILD_NUMBER',
body: 'Check console output at $BUILD_URL to view the results. \n\n ${CHANGES}',
attachLog: 'true',
attachmentsPattern: 'bin/log/compile.log'
Upvotes: 0
Reputation: 11
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.
Upvotes: 0
Reputation: 3689
Instead of using $DEFAULT_RECIPIENTS
use to:
emailext(
to: '[email protected]',
body: '${DEFAULT_CONTENT}',
mimeType: 'text/html',
subject: '${DEFAULT_SUBJECT}',
replyTo: '$DEFAULT_REPLYTO'
)
}
Ref: https://stackoverflow.com/a/39499554/1134084
Upvotes: 0
Reputation: 3707
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."
Upvotes: 54
Reputation: 2052
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()
}
}
}
}
Upvotes: 4