org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.163.com:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242)
at org.apache.commons.mail.Email.send(Email.java:1267)
at excelWatcher.MailUtil.send(MailUtil.java:35)
at excelWatcher.MailUtil.main(MailUtil.java:56)
Caused by: javax.mail.AuthenticationFailedException: 535 Error: authentication failed
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:826)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:761)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:685)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
... 3 more
log4j:WARN No appenders could be found for logger (excelWatcher.MailUtil).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
如果你是163或者126邮箱,那么你检查一下你网页端邮箱设置中 SMTP开启的时候,有授权码的,你重新关闭SMTP服务再重新开启你就知道了,代码中登录的密码其实是授权码。注意注意!!