• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • mailer-plugin, pipeline
    • None
    • Jenkins: 2.7.2
      Pipeline plugin 2.2
      Mailer plugin 1.17

      We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
      SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

      If I do something like this

      node {
          mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
      }
      

      Email not sent.

      I start digging into mailer plugin and figured out how emails work.
      I did some basic debugging out in pipeline code

      node {
          def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@xxx.com")).getClass();
          echo transportClass.toString();
          mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
      }
      

      and figured out that email transporter used in this instance is org.jvnet.mock_javamail.MockTransport

      [Pipeline] {
      [Pipeline] echo
      class org.jvnet.mock_javamail.MockTransport
      [Pipeline] mail
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      

      Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

      Is there any easy workaround this configuration?

          [JENKINS-40278] Emails are not sent from pipeline

          Pavel Polivka created issue -
          Pavel Polivka made changes -
          Description Original: We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
          SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

          If I do something like this
          {code}
          node {
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}
          Emails is still not sent.

          I start digging into mailer plugin and figured out how emails work.
          I did some basic debugging out in pipeline code
          {code}
          node {
              def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@idc.com")).getClass();
              echo transportClass.toString();
              mail body: 'test', subject: 'test', to: 'ppolivka@idc.com'
          }
          {code}

          and figured out that email transported used in this instance is org.jvnet.mock_javamail.MockTransport
          {code}
          [Pipeline] {
          [Pipeline] echo
          class org.jvnet.mock_javamail.MockTransport
          [Pipeline] mail
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          {code}

          Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

          Is there any easy workaround this configuration?
          New: We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
          SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

          If I do something like this
          {code}
          node {
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}
          Email not sent.

          I start digging into mailer plugin and figured out how emails work.
          I did some basic debugging out in pipeline code
          {code}
          node {
              def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@idc.com")).getClass();
              echo transportClass.toString();
              mail body: 'test', subject: 'test', to: 'ppolivka@idc.com'
          }
          {code}

          and figured out that email transported used in this instance is org.jvnet.mock_javamail.MockTransport
          {code}
          [Pipeline] {
          [Pipeline] echo
          class org.jvnet.mock_javamail.MockTransport
          [Pipeline] mail
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          {code}

          Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

          Is there any easy workaround this configuration?
          Pavel Polivka made changes -
          Description Original: We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
          SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

          If I do something like this
          {code}
          node {
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}
          Email not sent.

          I start digging into mailer plugin and figured out how emails work.
          I did some basic debugging out in pipeline code
          {code}
          node {
              def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@idc.com")).getClass();
              echo transportClass.toString();
              mail body: 'test', subject: 'test', to: 'ppolivka@idc.com'
          }
          {code}

          and figured out that email transported used in this instance is org.jvnet.mock_javamail.MockTransport
          {code}
          [Pipeline] {
          [Pipeline] echo
          class org.jvnet.mock_javamail.MockTransport
          [Pipeline] mail
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          {code}

          Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

          Is there any easy workaround this configuration?
          New: We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
          SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

          If I do something like this
          {code}
          node {
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}
          Email not sent.

          I start digging into mailer plugin and figured out how emails work.
          I did some basic debugging out in pipeline code
          {code}
          node {
              def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@xxx.com")).getClass();
              echo transportClass.toString();
              mail body: 'test', subject: 'test', to: 'ppolivka@idc.com'
          }
          {code}

          and figured out that email transported used in this instance is org.jvnet.mock_javamail.MockTransport
          {code}
          [Pipeline] {
          [Pipeline] echo
          class org.jvnet.mock_javamail.MockTransport
          [Pipeline] mail
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          {code}

          Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

          Is there any easy workaround this configuration?
          Pavel Polivka made changes -
          Description Original: We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
          SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

          If I do something like this
          {code}
          node {
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}
          Email not sent.

          I start digging into mailer plugin and figured out how emails work.
          I did some basic debugging out in pipeline code
          {code}
          node {
              def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@xxx.com")).getClass();
              echo transportClass.toString();
              mail body: 'test', subject: 'test', to: 'ppolivka@idc.com'
          }
          {code}

          and figured out that email transported used in this instance is org.jvnet.mock_javamail.MockTransport
          {code}
          [Pipeline] {
          [Pipeline] echo
          class org.jvnet.mock_javamail.MockTransport
          [Pipeline] mail
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          {code}

          Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

          Is there any easy workaround this configuration?
          New: We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
          SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

          If I do something like this
          {code}
          node {
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}
          Email not sent.

          I start digging into mailer plugin and figured out how emails work.
          I did some basic debugging out in pipeline code
          {code}
          node {
              def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@xxx.com")).getClass();
              echo transportClass.toString();
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}

          and figured out that email transported used in this instance is org.jvnet.mock_javamail.MockTransport
          {code}
          [Pipeline] {
          [Pipeline] echo
          class org.jvnet.mock_javamail.MockTransport
          [Pipeline] mail
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          {code}

          Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

          Is there any easy workaround this configuration?
          Pavel Polivka made changes -
          Description Original: We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
          SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

          If I do something like this
          {code}
          node {
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}
          Email not sent.

          I start digging into mailer plugin and figured out how emails work.
          I did some basic debugging out in pipeline code
          {code}
          node {
              def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@xxx.com")).getClass();
              echo transportClass.toString();
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}

          and figured out that email transported used in this instance is org.jvnet.mock_javamail.MockTransport
          {code}
          [Pipeline] {
          [Pipeline] echo
          class org.jvnet.mock_javamail.MockTransport
          [Pipeline] mail
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          {code}

          Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

          Is there any easy workaround this configuration?
          New: We started migrating our Jenkins jobs to pipeline jobs and our build status emails stopped working.
          SMTP configuration is working OK I received test email and non pipeline jobs are still sending emails.

          If I do something like this
          {code}
          node {
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}
          Email not sent.

          I start digging into mailer plugin and figured out how emails work.
          I did some basic debugging out in pipeline code
          {code}
          node {
              def transportClass = javax.mail.Session.getDefaultInstance(java.lang.System.getProperties(), (javax.mail.Authenticator)null).getTransport(new javax.mail.internet.InternetAddress("ppolivka@xxx.com")).getClass();
              echo transportClass.toString();
              mail body: 'test', subject: 'test', to: 'ppolivka@xxx.com'
          }
          {code}

          and figured out that email transporter used in this instance is org.jvnet.mock_javamail.MockTransport
          {code}
          [Pipeline] {
          [Pipeline] echo
          class org.jvnet.mock_javamail.MockTransport
          [Pipeline] mail
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
          {code}

          Again emails are working fine in non pipeline jobs. Configuration to use MockTransport is going from mock-javamail.jar based on classpath scanning. Is is possible that pipeline exposes this test jar to the classpath somehow?

          Is there any easy workaround this configuration?
          Pavel Polivka made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            Unassigned Unassigned
            ppolivka Pavel Polivka
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: