# Could not convert socket to TLS

**URL:** <https://forum.keycloak.org/t/could-not-convert-socket-to-tls/12050>\
**Category:** Miscellanaeous\
**Created:** [November 12, 2021, 10:24am UTC](https://forum.keycloak.org/t/could-not-convert-socket-to-tls/12050 "2021-11-12T10:24:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![girish](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/girish/32/7062_2.png) [@girish](https://forum.keycloak.org/u/girish)\
**Post date:** [November 12, 2021, 10:24am UTC](https://forum.keycloak.org/t/could-not-convert-socket-to-tls/12050/1 "2021-11-12T10:24:56Z")

</div>

Hi am trying to configure email from a realm in keycloak .  
Got following exception. when trying to send email.

Kindly help me to fix the below issue .

The server selected protocol version TLS11 is not accepted by client preferences [TLS12, SSL20Hello]  
Caused by: javax.mail.MessagingException: Could not convert socket to TLS;  
javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS11 is not accepted by client preferences [TLS12, SSL20Hello]  
com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2140) com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:734)  
at javax.mail.Service.connect(Service.java:342)  
at javax.mail.Service.connect(Service.java:222)  
at javax.mail.Service.connect(Service.java:243)  
org.keycloak.email.DefaultEmailSenderProvider.send(DefaultEmailSenderProvider.java:145)

Caused by: javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS11 is not accepted by client preferences [TLS12, SSL20Hello]

---

<div class="post-metadata">

**Author:** ![jangaraj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jangaraj/32/5175_2.png) [@jangaraj](https://forum.keycloak.org/u/jangaraj)\
**Post date:** [November 12, 2021, 10:42am UTC](https://forum.keycloak.org/t/could-not-convert-socket-to-tls/12050/2 "2021-11-12T10:42:06Z")

</div>

Your email server is trying to use TLS 1.1, but your Java version/configuration doesn’t allow to use TLS 1.1. Only TLS 1.2 - that is a secure option.

So the best option is to ask your email provider to support also TLS 1.2 on their servers.  
Less secure option will be to allow also TLS 1.1 in your java (for example in `java.security` file).
