본문 바로가기
Language/Java

[JAVA] SMTP Mail 기능 구현 : javax.mail.MessagingException: Could not convert socket to TLS 에러 처리

by 광진구뚝배기 2022. 6. 23.

에러 로그

 

spring boot 로 간단한 프로젝트를 하던 중, 메일 보내는 과정에서 아래와 같은 에러가 발생했다.

 

javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1652)

 

 

 

해결방법

 

TLS(Transport Layer Security) 의 버전이 안맞아서 생기는 오류다. 

( 참고. 내가 하고 있는 프로젝트의 jdk 버전은 1.8이다. )

 

아래의 코드 한 줄 추가해주면 에러 해결.

propt.put("mail.smtp.ssl.protocols", "TLSv1.2");

 

 

 

 

참고자료

 

https://knowhoon.tistory.com/117

 

 

 

 

반응형

댓글