実現したいこと
https://zenn.dev/codek2/articles/8a2b8b78eb4d53
を参考にメールを送信しようとしましたが失敗します。
どこを変えればメール送信に成功するかわかりません
発生している問題・分からないこと
Mail server connection failed. Failed messages: jakarta.mail.MessagingException: Could not convert socket to TLS;となり、メール送信できない。
エラーメッセージ
error
1 threw exception [Request processing failed: org.springframework.mail.MailSendException: Mail server connection failed. Failed messages: jakarta.mail.MessagingException: Could not convert socket to TLS; 2 nested exception is: 3 javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; message exceptions (1) are: 4Failed message 1: jakarta.mail.MessagingException: Could not convert socket to TLS; 5 nested exception is: 6 javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target] with root cause 7 8sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 9 at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:148) ~[na:na] 10、、、
該当のソースコード
特になし
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
・https://medium-company.com/spring-boot-thymeleaf/
でHelloworldは出るので、springbootは問題なさそう
・application.properties
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.password=アプリパスワード
spring.mail.properties.mail.smtp.ssl.protocols=TLSv1.2
・https://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ?rq=1
を参考にgmailのcrtファイルいれました。
補足
バージョン情報
Eclipse 2022
java jdk-17.0.12.7-hotspot

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2025/01/25 05:15