Hey,guys!
My jars are "geronimo-javamail_1.4_mail-1.8.jar" and
"geronimo-javamail_1.4_provider-1.8.jar" ,when I set the wrong username and
password of email, after the smtp server reply "535 Authentication
unsuccessful" , the program is blocked,
and the socket connection will not be disconnect until the smtp server reset it.
so I tried to debug and find something:
the code of "javax.mail. Service" in "geronimo-javamail_1.4_mail-1.8.jar"
below
try
{
this.connected = protocolConnect(host, port, user, password);
}
catch (AuthenticationFailedException e)
{
}
if (!this.connected) {
InetAddress ipAddress = null;
try
{
ipAddress = InetAddress.getByName(host);
}
catch (UnknownHostException e)
{
}
PasswordAuthentication promptPassword =
this.session.requestPasswordAuthentication(ipAddress, port, protocol, null,
user);
if (promptPassword != null) {
user = promptPassword.getUserName();
password = promptPassword.getPassword();
}
this.connected = protocolConnect(host, port, user, password);
}
because of the red code is out of the range "if(){}" , even if the client
cann't get "promptPassword" , it also will try to connect again with wrong
username and password
,but this time it will be blocked at the code of
"org.apache.geronimo.javamail.transport.smtp.SMTPTransport" in
"geronimo-javamail_1.4_provider-1.8.jar"
/**
* Get the server's welcome blob from the wire....
*/
protected boolean getWelcome() throws MessagingException {
SMTPReply line = getReply();
// just return the error status...we don't care about any of the
// response information
return !line.isError();
}
So I think the right code should be:
if (promptPassword != null) {
user = promptPassword.getUserName();
password = promptPassword.getPassword();
this.connected = protocolConnect(host, port, user, password);
}
Would you please confirm this bug? Thank you!