JAMES SMTP Server 2.3.2
config.xml加了:
<authRequired>announce</authRequired>
错误信息
DEBUG: setDebug: JavaMail version 1.3
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG: SMTPTransport trying to connect to host "10.237.89.20", port 25
DEBUG SMTP RCVD: 220 ebtqa.com SMTP Server (JAMES SMTP Server 2.3.2) ready Fri, 28 Dec 2012 08:25:53 -0600 (CST)
DEBUG: SMTPTransport connected to host "10.237.89.20", port: 25
DEBUG SMTP SENT: EHLO psc-SteveSun-01
DEBUG SMTP RCVD: 250-ebtqa.com Hello psc-SteveSun-01 (10.237.88.104 [10.237.88.104])
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-PIPELINING
250 ENHANCEDSTATUSCODES
DEBUG SMTP Found extension "AUTH", arg "LOGIN PLAIN"
DEBUG SMTP Found extension "AUTH=LOGIN", arg "PLAIN"
DEBUG SMTP Found extension "PIPELINING", arg ""
DEBUG SMTP Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP SENT: AUTH LOGIN
DEBUG SMTP RCVD: 334 VXNlcm5hbWU6
DEBUG SMTP SENT: bXN1bg==
DEBUG SMTP RCVD: 334 UGFzc3dvcmQ6
DEBUG SMTP SENT: bXN1bg==
DEBUG SMTP RCVD: 235 Authentication Successful
Sending failed;
nested exception is:
class javax.mail.AuthenticationFailedException
安全认证的代码:
authenticator = new MyAuthenticator(getHostUser(), getHostPassword());
_session = Session.getInstance(prop, new Authenticator() {
protected javax.mail.PasswordAuthentication getPasswordAuthentication() {
return new javax.mail.PasswordAuthentication(getHostUser(),
getHostPassword());
}
});
如何解决?谢谢
请确认认证信息!DEBUG SMTP RCVD: 235 Authentication Successful
这里你权限验证以及成功了。
然后说:
Sending failed;
nested exception is:
class javax.mail.AuthenticationFailedException
你看下你的代码中是否用了Transport.send(msg)这样的方法
换成下面的试试:
Transport transport=session.getTransport();
transport.send(msg,new Address[]{new InternetAddress("xxx@sina.com")});