Spring发送邮件时遇到的错误和解决方法

Spring发送邮件时遇到的错误和解决方法

错误一

org.springframework.mail.MailAuthenticationException: Authentication failed;

原因

java程序发送邮件时,用户认证失败导致如下错误:

org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535 Error: xxxxxxx: http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256

解决方法

1,检查自己邮箱是否开通pop3/smtp服务。
2、程序中所填的邮箱密码是否为开通pop3/smtp服务时所给的授权码。

错误二

spring发邮件被识别为垃圾邮件:org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 554 DT:SPM 163

原因

使用spring发邮件被当垃圾邮件了(这里具体原因还不知道为什么会被当成垃圾邮件)。根据错误提示,进入163邮箱的退信代码说明http://help.163.com/09/1224/17/5RAJ4LMH00753VB8.html
可以看到说是被当成了垃圾邮件
在这里插入图片描述

解决方法

在网上找到的解决方法之一是添加抄送,那就抄送给自己吧。
在这里插入图片描述
添加抄送之后发送成功。

发布了13 篇原创文章 · 获赞 0 · 访问量 146

猜你喜欢

转载自blog.csdn.net/coffee_dount/article/details/105593557