jakarta.mail.MessagingException: Got bad greeting from SMTP host: smtp.163.com, port: 465, response: [EOF]

jakarta.mail.MessagingException: Got bad greeting from SMTP host: smtp.163.com, port: 465, response: [EOF]

以上的异常解决办法是 添加 spring.mail.protocol=smtps

spring:
  mail:
    host: smtp.163.com
    port: 465
    username: xxx@163.com
    password: 授权码
    properties:
      mail:
        debug: true
        smtp:
          auth: true
          starttls.enable: true
          socketFactoryClass: javax.net.ssl.SSLSocketFactory
    default-encoding: UTF-8
    protocol: smtps


再次运行

DEBUG SMTP: message successfully delivered to mail server
QUIT
221 Bye
Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐