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

jakarta email doesn't work as expected in prebuild

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Minor Minor
    • email-ext-plugin
    • None
    • Jenkins 2.346.2
      Mailer 435.v79ef3972b_5c7
      Pipeline: Basic Steps 980.v82219a_ed188e
      Email Extension 2.90
      Mail Watcher 1.17

      When running email rules since Email Extension 2.90, getting the error that javax function not found. 

      However, as you can see below, my updated template does not contain javax, only jakarta

      import jakarta.mail.*
      def envVars = run.getEnvironment(listener)
      def blocklist = envVars.get("EMAIL_BLOCKLIST")
      def debug = envVars.get("debug")
      recipients = msg.getRecipients(jakarta.mail.Message.RecipientType.TO)
      if (debug == "high")

      {     logger.println envVars.get("BUILD_ID") + " is the build id returned to email" }

      if (debug == "true") {
       recipients.each

      { addr ->   logger.println(addr)  }

      }
      filtered = recipients.findAll { addr -> (!(addr.toString().toUpperCase()?.contains('xxx')) && !(addr.toString().toUpperCase()?.contains('yyy')) && !(blocklist?.contains(addr.getAddress().split('@')[0]))) }
      msg.setRecipients(jakarta.mail.Message.RecipientType.TO, filtered as jakarta.mail.Address[])
      if(run.result.toString().equals("FAILURE"))

      {  msg.addHeader("X-Priority","1 (Highest)");  msg.addHeader("Importance", "High"); }

      cancel=run.result.toString().equals("ABORTED");

            Unassigned Unassigned
            pcarenza Peter Carenza
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: