jenkinsjenkins-pluginsemail-extjenkins-email-ext

sporadic issue with jenkins email-ext plugin


I have email notifications set up in a jenkins pipeline job using email-ext (v2.57.2). The emails are sent fine for the first couple of iterations but then after about 4th execution, the following error occurs (and continues happening for all the subsequent runs):

> [Pipeline] emailext messageContentType = text/html; charset=UTF-8
> Adding recipients from project recipient list Adding recipients from
> trigger recipient list Successfully created MimeMessage An attempt to
> send an e-mail to empty list of recipients, ignored. Some error
> occured trying to send the email...check the Jenkins log

Not quite sure which Jenkins log to look at...


Solution

  • Figured out that it had to do with the use of $class: "RequesterRecipientProvider. When a job runs in a scheduled fashion, this value comes up as null. Only when the job is run manually is it populated.

    Ended up switching the Jenkinsfile over to use a jenkins environment variable.

    def emailRecipients = "${env.EMAIL_RECIPIENTS}";
    emailext (subject: subject, body: details, to: emailRecipients)