SpringBoot配置发送Email 535 Error: authentication failed
其实spring boot配置发送email 很简单 但是我却弄了一天才弄出啦。。。。。
按照教程(其实找了很多,几乎都是一样的,哈哈)正常应该不会出问题 但是我的却一直报错
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535 Error: authentication failed
网上的解决方案就是这个
解决方案:因为JDK1.8中jre\lib\security
中两个 jar 包替换的缘故。将下载后的local_policy.jar
和US_export_policy.jar
替换到JDK1.8的jre\lib\security
文件夹即可。
地址:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
按照这个也做了 还是一样的报错
还有说password 的问题 我前前后后弄了好多遍 就怕自己弄错了 依旧还是报这个错误。。。
后来我又复制了一份配置文件 竟然成功了。。。。
spring.mail.host=smtp.163.com
[email protected]
spring.mail.password=testword
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.host=smtp.163.com
[email protected]
spring.mail.password=testword
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
比对了一遍又一遍 这不是一摸一样的么
我用了绝招 tortoise diff 比对
看出问题了吧 原来我的用户名后面多了几个空格。。。
看来配置文件的空格也被识别了 终于找到原因 特此记录 希望有遇到和我一样问题的也能快点解决