RE: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connect

a g, modified 8 Years ago. Expert Posts: 442 Join Date: 3/2/12 Recent Posts
Under Control Panel -> Server Administration -> Mail, I setup a smtp connection.

Hostname <office 365 hostname>
Port 587
Use secure: Yes
User <user_email_address>
Password <password>

below error I am getting:
Please let me know how to fix this issue in Liferay7 CE.
ERROR [liferay/mail-1][MailEngine:131] null
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710)
at sun.security.ssl.InputRecord.read(InputRecord.java:527)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:928)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at com.liferay.util.mail.MailEngine._send(MailEngine.java:554)
at com.liferay.util.mail.MailEngine.send(MailEngine.java:354)
at com.liferay.util.mail.MailEngine.send(MailEngine.java:429)
at com.liferay.mail.messaging.MailMessageListener.doMailMessage(MailMessageListener.java:94)
at com.liferay.mail.messaging.MailMessageListener.doReceive(MailMessageListener.java:109)
at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
a g, modified 8 Years ago. Expert Posts: 442 Join Date: 3/2/12 Recent Posts
Any solution for
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connect


How to fix in the Liferay7.0 CE.

Regards
Anand Gopalan
Vignesh kumar, modified 5 Years ago. New Member Posts: 2 Join Date: 11/20/19 Recent Posts
I have faced the same issue. when i configured with port 465 works fine but if i use 25 or 587 doesnot works. Could you please help? Please find the error belowjavax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710)
    at sun.security.ssl.InputRecord.read(InputRecord.java:527)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
    at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:938)
    at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
    at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
    at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
    at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
    at javax.mail.Service.connect(Service.java:275)
    at com.liferay.petra.mail.MailEngine._send(MailEngine.java:588)
    at com.liferay.petra.mail.MailEngine.send(MailEngine.java:387)
    at com.liferay.petra.mail.MailEngine.send(MailEngine.java:462)
    at com.liferay.mail.messaging.MailMessageListener.doMailMessage(MailMessageListener.java:94)
    at com.liferay.mail.messaging.MailMessageListener.doReceive(MailMessageListener.java:109)
    at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Vignesh kumar:

I have faced the same issue. when i configured with port 465 works fine but if i use 25 or 587 doesnot works. Could you please help? Please find the error belowjavax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710)
My first assumption is that you're connecting to a clear-text SMTP-server but attempt to talk TLS (SSL) with it. At least that's what the message says. Can you confirm or deny this?
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I think, Liferay has a bug here. I am not a 100% sure, I was in a hurry when I tested it. But when you set the secure flag, Liferay always uses port 25, not the configured port. I think, it should work if you set the mail settings in portal-ext properties and not through the UI.  I also didn't test this, I was in a hurry, so I just installed postfix and used it to route the mails to the correct server with tls.
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Christoph Rabel:

I think, Liferay has a bug here. I am not a 100% sure, I was in a hurry when I tested it. But when you set the secure flag, Liferay always uses port 25, not the configured port. I think, it should work if you set the mail settings in portal-ext properties and not through the UI.  I also didn't test this, I was in a hurry, so I just installed postfix and used it to route the mails to the correct server with tls.
In that case I'll add my standard question about the exact version - and if it can still be reproduced on the latest GA of that release.
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
The version I used, was 7.2 CE GA1 . I wanted to add an issue for it, but it fell into a hole ...
I will do a quick test on the weekend, I want to try some other things out too.
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I have created LPS-104877
@a g: Please try to set the mail properties through portal-ext instead of through the UI. I think, that should work.
Mark Molina, modified 5 Years ago. New Member Posts: 11 Join Date: 10/14/11 Recent Posts
Hello, I am facing exactly the same problem. I saw that reported issue still open and probably it is not fixed yet. I am using 7.3.3-GA4 version of Liferay, I set the properties as suggested in thread but it still without working for me and the "javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?" exception is thrown. There are specific properties for SMTPS (additional to SMTP settings)? Thanks!