Issue
- After configuring a secure mail server in Control Panel > Server Administration, the email notice for a new account created (or any other mail coming from Liferay DXP) is not sent. Instead, the stacktrace below is shown on the logs.
2020-06-01 15:30:21.926 ERROR [liferay/mail-1][MailEngine:128] Unable to send message: Can't send command to SMTP host
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2033)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1135)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:757)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:101)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1418)
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1408)
at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:847)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:384)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at com.liferay.petra.mail.MailEngine._send(MailEngine.java:627)
Environment
- Liferay DXP 7.0
- Liferay DXP 7.1
- Liferay DXP 7.2
- Secure (TLS) mail server
Resolution
- The issue comes from an outdated javax.mail library in current portal versions. The javax.mail library Liferay uses doesn't support TLS v1.2, it only supports TLS v1.x.
- As such, mail servers which don't offer TLS v1.1 and 1.0 can't be used to send mail from Liferay DXP.
- The resolution is documented on LPS-114513 and is currently being reviewed. If you can't wait for an official fixpack, please open a support ticket mentioning you need the fix for LPS-114513 and provide your current patchinfo.
Additional Information
-
LPS-114513: Upgrade javax.mail to 1.6.2 to be able to use mail.<prot>.ssl.protocols