【问题标题】:Spring mail disable TLSSpring邮件禁用TLS
【发布时间】:2018-06-01 10:19:13
【问题描述】:

我尝试使用 localhost 作为邮件服务器,但收到“454 4.7.0 TLS not available due to local problem”错误。

如何禁用邮件的 TLS?

我正在使用 Spring Boot。

【问题讨论】:

    标签: spring ssl spring-boot jakarta-mail


    【解决方案1】:

    mail.smtp.starttls.enablemail.smtp.starttls.required 是 JavaMail 中定义的两个属性。但是,为了在 Spring 应用程序中使用它们,我们需要使用 Spring 中的“附加属性”方法将它们添加到应用程序属性中。相关摘自Spring Boot reference

    spring.mail.properties.*= # Additional JavaMail session properties.
    

    因此,简而言之,我们需要在 application.properties 文件中添加以下内容,以便在 Spring 中使用不带 TLS 的邮件:

    spring.mail.properties.mail.smtp.starttls.enable=false
    spring.mail.properties.mail.smtp.starttls.required=false
    

    Source

    【讨论】:

    • FWIW 仅添加 .enable 对我有用(但启动 1.5.5);无需添加.required 条目
    猜你喜欢
    • 2020-06-30
    • 2015-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 2017-12-11
    • 2021-03-13
    • 2012-09-10
    相关资源
    最近更新 更多