2

Upgraded to JDK 11.0.16 and the emails server is failing to send emails. before that on JDK 11.0.6, emails were working fine.

I checked my config 100 times, but getting to know JDK from 11.0.11 disabled the TLSv1, TLSv1.1 support

https://github.com/openjdk/jdk/blob/67141849d922a3899fcb4429a520b874b7d91b4c/src/java.base/share/conf/security/java.security#L736

What could be the possible solutions to fix this, so that my application keep sending an email!

Dupinder Singh
  • 7,175
  • 6
  • 37
  • 61

1 Answers1

1

The possible solutions could be

Solution1.

Edit the java.security file and remove the TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms

location of java security file is usr/local/openjdk-11/conf/security/java.security

Solution 2.

The Second solution could be forcing your Mail implementation to use TLSv1.2 like this

    // add this line mail.smtp.ssl.protocols=TLSv1.2; in properties
    // in your Mail Implementation class
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.ssl.protocols","TLSv1.2");

or your Java Mail impl will look like this

Properties prop = new Properties();
prop.setProperty("mail.smtp.auth", "true");
prop.setProperty("mail.smtp.starttls.enable", "true");
prop.setProperty("mail.smtp.ssl.protocols", "TLSv1.2"); // New Line
prop.setProperty("mail.smtp.ssl.trust", mailUri.getHost());
mailSender.setJavaMailProperties(prop);

These solutions should help :)

Dupinder Singh
  • 7,175
  • 6
  • 37
  • 61