diff --git a/app/src/main/java/com/sun/mail/smtp/SMTPTransport.java b/app/src/main/java/com/sun/mail/smtp/SMTPTransport.java index b0e3de71d3..aec06aa31f 100644 --- a/app/src/main/java/com/sun/mail/smtp/SMTPTransport.java +++ b/app/src/main/java/com/sun/mail/smtp/SMTPTransport.java @@ -2002,13 +2002,30 @@ public class SMTPTransport extends Transport { break; default: - // handle remaining 4xy & 5xy codes + // handle remaining 2xy, 4xy & 5xy codes if (retCode >= 400 && retCode <= 499) { // assume address is valid, although we don't really know validUnsent.add(ia); } else if (retCode >= 500 && retCode <= 599) { // assume address is invalid, although we don't really know invalid.add(ia); + } else if (retCode >= 200 && retCode <= 299) { + // see RFC 5321 section 4.3.2 + // assume address is valid, although we don't really know + valid.add(ia); + if (!reportSuccess) + break; + + // user wants exception even when successful, including + // details of the return code + + // create and chain the exception + sfex = new SMTPAddressSucceededException(ia, cmd, retCode, + lastServerResponse); + if (mex == null) + mex = sfex; + else + mex.setNextException(sfex); } else { // completely unexpected response, just give up if (logger.isLoggable(Level.FINE))