zoukankan      html  css  js  c++  java
  • 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

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

  • 相关阅读:
    小Z的袜子
    C#操作XML
    C#中接口的实现方法
    C#邮箱批量注册
    C# 委托的使用
    C# socket
    在C#.net中如何操作XML
    C#接口的基础知识
    C#判断网页中是否含有某字符串
    C#多线程处理多个队列的数据
  • 原文地址:https://www.cnblogs.com/east7/p/13406120.html
Copyright © 2011-2022 走看看