Search code examples
javagmailjakarta-mail

Unable to connect to smtp.gmail.com from JavaMail based module


This has been working for years but since a few weeks, my JavaMail based modules report an error when trying to connect smtp.gmail.com:

The debugging output looks as follows:

DEBUG: setDebug: JavaMail version 1.4.7
DEBUG: getProvider() returning
javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
MessagingException javax.mail.MessagingException: Could
not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
        javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
Certificate signature validation failed

I cannot seem to understand where this problem comes from and any help on how to track this down would be most appreciated.


Solution

  • It seems as if simply replacing the lib/security/cacerts file with a version of the file from the most current jdk would have solved the problem.