에러내용 : 이메일주소를 넣고, 임시비밀번호를 메일로 발급받는 기능을 구현하던 중에 발생한 에러.
org.springframework.mail.MailSendException: Mail server connection failed; nested exception is 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). Failed messages: 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); message exceptions (1) are: Failed message 1: 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)
해결방법 : root-context.xml에 다음 prop을 추가한다.
<prop key="mail.smtp.ssl.trust">smtp.gmail.com</prop>
<prop key="mail.smtp.ssl.protocols">TLSv1.2</prop>
- 나같은 경우, <prop key="mail.smtp.ssl.trust">smtp.gmail.com</prop> 는 생략해도 정상적으로 구동되었다.
적용한 코드
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com" />
<property name="port" value="587" />
<property name="username" value="발송메일주소" />
<property name="password" value="비밀번호" />
<property name="javaMailProperties">
<props>
<prop key="mail.transport.protocol">smtp</prop>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.debug">true</prop>
<!-- <prop key="mail.smtp.ssl.trust">smtp.gmail.com</prop> -->
<prop key="mail.smtp.ssl.protocols">TLSv1.2</prop>
</props>
</property>
</bean>
'SPRING > 나의 고통(Error)' 카테고리의 다른 글
public key retrieval is not allowed (0) | 2021.09.15 |
---|---|
NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException (0) | 2021.08.10 |
Could not set parameters for mapping (0) | 2021.07.28 |
Could not convert socket to TLS (0) | 2021.07.26 |
servlet.xml에 namespace탭이 안보일 때 (0) | 2021.07.22 |