YI-LANG

查看链接:https://www.cnblogs.com/east7/p/13406120.html

 

  在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

  结论:重启服务,经验证问题搞定。其实,网上很多人写的博客都把配置信息写错了,我就是抄错了,这里记下来,亡羊补牢。

分类:

技术点:

相关文章:

  • 2021-07-26
  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
  • 2021-10-31
  • 2021-12-10
  • 2022-12-23
  • 2022-01-20
猜你喜欢
  • 2022-02-12
  • 2021-12-01
  • 2022-12-23
  • 2021-12-31
  • 2021-08-14
  • 2022-01-20
  • 2022-12-23
相关资源
相似解决方案