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

Emails are not sent from pipeline

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: mailer-plugin, pipeline
    • Labels:
      None
    • Environment:
      Jenkins: 2.7.2
      Pipeline plugin 2.2
      Mailer plugin 1.17
    • Similar Issues:

      Description

      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?

        Attachments

          Activity

          ppolivka Pavel Polivka created issue -
          ppolivka Pavel Polivka made changes -
          Field Original Value New Value
          Description 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?
          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?
          ppolivka Pavel Polivka made changes -
          Description 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?
          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?
          ppolivka Pavel Polivka made changes -
          Description 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?
          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?
          ppolivka Pavel Polivka made changes -
          Description 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?
          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?
          ppolivka Pavel Polivka made changes -
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Closed [ 6 ]

            People

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

              Dates

              Created:
              Updated:
              Resolved: