Spring邮件禁用TLS

问题描述 投票:0回答:1

我正在尝试使用localhost作为邮件服务器,但由于本地问题而导致“454 4.7.0 TLS不可用”错误。

如何禁用邮件的TLS?

我正在使用Spring Boot。

spring ssl spring-boot javamail
1个回答
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

© www.soinside.com 2019 - 2024. All rights reserved.