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

            People

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

              Dates

              Created:
              Updated:
              Resolved: