Email corruption / broken using Jenkins

Does anyone have experience with this unusual problem? As soon as I uninstall Jenkins (& restart tomcat), I can send java emails just fine through Tomcat. When I load the Jenkins war it breaks emails being sent immediately, by our other installed (custom) java apps in Tomcat. This server has been around for 6+ years, and the problem just starting occurring on Jan 24th of this year, without me knowing what changed. Looking at the smtp logs, it corrupts the mail before it leaves the system, before it hits the mail server. Replacing the original message with garbage like this example below:


SOMEHOW - The HTML messages gets turned into content type “text/plain”?

Curiously when I deleted the ‘work’ dir under tomcat it temporarily solved the problem, allowing emails to be sent properly/correctly, but email eventually became corrupt again, just min later, and deletion of the ‘work’ dir does nothing now (tried many times). I removed every mail related plugin in the .jenkins install dir, thinking the JVM was being corrupted with multiple java mail files, with no success/luck on the email send. Searched through the tomcat/markmail archive, Jenkins forum, and google with nothing really matching the described issue.

Env: Oracle Linux 7.9
Tomcat: 8.5.72 (tried with 8.5.65, when I know it was working)
Java: jdk1.8.0_311 (tried with 281, when I know it was working) & it fails with jdk 14
Apr: 1.7.0 / Apr-util: 1.6.1 / Openssl: 1.1.1l / tomcat-native: 1.2.31-src
Jenkins: 2.3612.1 LTS (tried several / various previous versions that I know worked)
Postfix: 2.10.1-9.el7.x86_64
Mail Jar: javax.mail-1.6.2-6.jar

Hello @rdecker ,

It may have nothing to do with your problem, but the 2.361.2 LTS version is not compatible with JDK 8 anymore. You have to switch to JDK 11 or 17.
Require Java 11 or newer. (Blog post, issue 68570, JEP-236, pull 6083)

Yes, it failed w/ Java 17 as well → jdk- Same issues as Java 8.

1 Like

I disabled the JavaMail API plugin in Jenkins, and that fixed the problem…

1 Like

Good to know, thanks a lot for your feedback.