Got bad greeting from SMTP host: smtp.163.com, port: 465, response: [EOF]
生活随笔
收集整理的這篇文章主要介紹了
Got bad greeting from SMTP host: smtp.163.com, port: 465, response: [EOF]
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在Spring Boot項目中,使用org.springframework.mail.javamail.JavaMailSender發送郵件拋異常,異常信息:
Mail server connection failed; nested exception is javax.mail.MessagingException: Got bad greeting from SMTP host: smtp.163.com, port: 465,
response: [EOF]. Failed messages: javax.mail.MessagingException: Got bad greeting from SMTP host: smtp.163.com, port: 465, response: [EOF]
問題分析:設置郵件協議的時候,配置如下:
spring.mail.protocol=smtp
#設置ssl端口
spring.mail.port=465
注意,是smtp,結尾沒有字母s。另外,在不設置該屬性的時候,系統默認使用SMTP協議。
解決方案:修改配置文件,使用郵件傳輸協議SMTPS,使得傳輸協議與端口465相匹配:
spring.mail.protocol=smtps
結論:重啟服務,經驗證問題搞定。其實,網上很多人寫的博客都把配置信息寫錯了,我就是抄錯了,這里記下來,亡羊補牢。
總結
以上是生活随笔為你收集整理的Got bad greeting from SMTP host: smtp.163.com, port: 465, response: [EOF]的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL Explain查看执行计划详
- 下一篇: Django Web应用开发实战附录A