0

I am trying to read mails with my JAR file. I am running this jar inside a container. When running I face the below exception.

javax.mail.MessagingException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate);
  nested exception is:
    javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:670)
    at javax.mail.Service.connect(Service.java:295)
    at javax.mail.Service.connect(Service.java:176)

What may be the reason for this exception? Do I need to expose any port in container? (I already exposed port 587). Is there a way to check if the mail server is reachable from the container?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • You don't need to do anything to allow outgoing connections _from_ docker, only incoming ones to it, and anyway this problem is not a network problem, it is entirely within the Java process. Are you using or did you change to a recent Java version? If so, probable dupe https://stackoverflow.com/questions/67348150/getting-a-no-appropriate-protocol-error- and cross https://superuser.com/questions/1649382/upgrade-from-openjdk-11-0-7-to-11-0-11-causes-sslhandshakeexception- – dave_thompson_085 May 28 '21 at 21:11
  • @dave_thompson_085 you are right exactly. I am using java 8u292 version which has disabled TLS 1.0 and 1.1. Will enabling this will help or is there any other solution to solve this – Saravanan Shanmugaraj May 29 '21 at 05:38
  • @dave_thompson_085 removing TLS V1.0 and 1.1 from java.security file solves this issue! – Saravanan Shanmugaraj May 29 '21 at 06:03

0 Answers0