`

454 Authentication failed, please open smtp flag first!

阅读更多
用spring发送邮件,使用的是QQ邮箱,出现以下错误信息:

/*Exception in thread "main" org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 454 Authentication failed, please open smtp flag first!

	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:392)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:336)
	at cn.com.songjy.spring.mail.SpringSendMail.sendHtml(SpringSendMail.java:97)
	at cn.com.songjy.spring.mail.SpringSendMail.main(SpringSendMail.java:60)
Caused by: javax.mail.AuthenticationFailedException: 454 Authentication failed, please open smtp flag first!

	at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:823)
	at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:756)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:673)
	at javax.mail.Service.connect(Service.java:295)
	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:389)
	... 4 more*/



原因是我使用的QQ邮箱没有开通POP3/SMTP服务,登录邮箱开启该服务即可

利用Spring框架封装的JavaMail实现同步或异步邮件发送
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics