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.jarUS_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
spring.mail.username=test@163.com   
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
spring.mail.username=test@163.com
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 比对


看出问题了吧  原来我的用户名后面多了几个空格。。。

看来配置文件的空格也被识别了   终于找到原因   特此记录   希望有遇到和我一样问题的也能快点解决 

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值