I saw this error message once I updated to JDK 11 when trying to send emails initially I didn’t have time to figure out a long term solution so I took a shortcut and removed Tls 1.0 from blocked algorithms in the java.security file. (I know that was a bad move but I was on a time crunch so I wasn’t thinking clearly 🙂 )
Things were ok for a while until an update of JDK replaced my update to java.security file, at this point I figured I would have to keep repeating this dance every few months or get a long term solution.
I use apache commons library to send email and by default it uses < TLS v1.2 and JDK 11+ supports > TLS v1.2. The permanent fix just turned out to be specifying TLS version to be used and my app was able to get back to sending emails without any issues and this time it was future proofed from future update breakage due to JDK updates. Below are the parmeter updates needed.
#Method 1 adding a system property
System.setProperty("mail.smtp.ssl.protocols", "TLSv1.2");
System.setProperty("mail.pop3s.ssl.protocols", "TLSv1.2");
#Method 2 setting value in a property file
spring.mail.properties.mail.smtp.ssl.protocols=TLSv1.2
spring.mail.properties.mail.pop3s.ssl.protocols=TLSv1.2
I went with Method #2 as it allows easier management of properties but every bodies use case is different so you can go with whatever works for your situation.