-
Bug
-
Resolution: Not A Defect
-
Major
-
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?
This is happening when you have mock-javamail.jar on your classpath. I went through our Jenkins plugins and noticed that somebody added plugin that was not from Jenkins repository but build by hand from somebody from other team. This plugin had this jar on the classpath. After the plugin was removed and Jenkins restarted mails started working.