简体   繁体   中英

Jenkins email-ext plugin thinks I have no recipients configured

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?

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."

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()
            }
        }
    }
}

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

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. 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM