Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-13805

email-ext plugin cannot see env variables set as part of build config

      I have tried to use env variable DEFAULT_RECIPIENTS as part of build, and not as part of global env variables
      I need DEFAULT_RECIPIENTS value to be different for each job

      I try to set it as part of build step

      but the value is NOT available when email ext tries to send email

      I get

      ===

      Recording test results
      Email was triggered for: Success
      Sending email for trigger: Success
      Sending email to: $team.acids
      ERROR: Could not send email as a part of the post-build publishers.
      com.sun.mail.smtp.SMTPSendFailedException: 250 2.6.0 <26943585.5.1337190669479.JavaMail.CAUDSWAP41$@CAUDSWAP41> Queued mail for delivery
      ;
      nested exception is:
      com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 User unknown

      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1112)
      at javax.mail.Transport.send0(Transport.java:195)
      at javax.mail.Transport.send(Transport.java:124)
      at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:263)
      at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:247)
      at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:207)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:678)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:656)
      at hudson.model.Build$RunnerImpl.cleanUp(Build.java:171)
      at hudson.model.Run.run(Run.java:1454)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:238)
      Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 User unknown

      at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1686)
      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1098)
      ... 14 more
      Notifying upstream projects of job completion
      Finished: SUCCESS

          [JENKINS-13805] email-ext plugin cannot see env variables set as part of build config

          Alex Earl added a comment -

          DEFAULT_RECIPIENTS is not an environment variable, it is a token that is replaced. If you want to use an environment variable use the ENV token (see the Content Token Reference info in the help section of the plugin).

          Alex Earl added a comment - DEFAULT_RECIPIENTS is not an environment variable, it is a token that is replaced. If you want to use an environment variable use the ENV token (see the Content Token Reference info in the help section of the plugin).

          Alex Earl added a comment -

          This is not a bug, DEFAULT_RECIPIENTS is not an environment variable. Use the ENV content token in the recipients field to use an environment variable.

          Alex Earl added a comment - This is not a bug, DEFAULT_RECIPIENTS is not an environment variable. Use the ENV content token in the recipients field to use an environment variable.

          kalpesh soni added a comment -

          what syntax do i use? its not documented anywhere

          kalpesh soni added a comment - what syntax do i use? its not documented anywhere

          Alex Earl added a comment -

          Yes, it is documented in the content macro reference when configuring the plugin.

          Alex Earl added a comment - Yes, it is documented in the content macro reference when configuring the plugin.

            slide_o_mix Alex Earl
            mrkk kalpesh soni
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: