AuthenticationFailedException: 535 Error: authentication failed解决方案

JavaMail踩过的坑:

Caused by: javax.mail.AuthenticationFailedException: 535 Error: authentication failed
	at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:947)
	at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:858)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:762)
	at javax.mail.Service.connect(Service.java:342)
	at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:518)
	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:437)
	... 71 more

JavaMail发送邮件失败问题:
1,检查自己邮箱是否开通pop3/smtp服务。
2、配置文件中的邮箱密码是否为开通pop3/smtp服务时所给的授权码,注意不是账号密码。
3、spring.mail.host=smtp.163.com,这里的host不同的邮箱不一样,这个是网易的
4、spring.mail.properties.mail.smtp.ssl.enable=true,这里要设置位true
最后,以上都没问题,我遇到了一个大坑,被新浪邮箱坑惨了,邮件总是发送失败…快被整吐了的,最后换成网易邮箱一下就好了。具体也不知道什么原因(可能新浪给俺拉黑了)

下面是我的mail配置文件

#MailProperties
spring.mail.host=smtp.163.com
spring.mail.port=465
spring.mail.username=lesliehh920@163.com
spring.mail.password=YIMSGZZQUPDCLSYW
spring.mail.protocol=smtps
spring.mail.properties.mail.smtp.ssl.enable=true
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值