Package com.sun.mail.smtp

Examples of com.sun.mail.smtp.SMTPAddressFailedException


        final SMTPSendFailedException se = (SMTPSendFailedException) e.getNextException();
        return se.getCommand() + " failed " + " with " + se.getReturnCode() + " (" + e.getMessage() + ")";
      } else if (e.getNextException() instanceof SMTPAddressFailedException) {
        // copied from above, as there is no common base class but same
        // methods
        final SMTPAddressFailedException se = (SMTPAddressFailedException) e.getNextException();
        return se.getCommand() + " failed " + " with " + se.getReturnCode() + " (" + e.getMessage() + ")";
      } else {
        final StringBuilder buf = new StringBuilder();
        Address[] addresses = ((SendFailedException) e).getInvalidAddresses();
        if (addresses != null) {
          for (final Address a : addresses) {
View Full Code Here


        final int rc = se.getReturnCode();
        return !PERMANENT_ERROR_CODES.contains(rc);
      } else if (e.getNextException() instanceof SMTPAddressFailedException) {
        // copied from above, as there is no common base class but same
        // methods
        final SMTPAddressFailedException se = (SMTPAddressFailedException) e.getNextException();
        final int rc = se.getReturnCode();
        return !PERMANENT_ERROR_CODES.contains(rc);
      } else {
        return true;
      }
    } else {
View Full Code Here

            }
            Exception ne;
            while ((ne = me.getNextException()) != null && ne instanceof MessagingException) {
                me = (MessagingException)ne;
                if (me instanceof SMTPAddressFailedException) {
                    SMTPAddressFailedException e = (SMTPAddressFailedException)me;
                    log("ADDRESS FAILED:");
                    log(e.toString());
                    log("  Address: " + e.getAddress());
                    log("  Command: " + e.getCommand());
                    log("  RetCode: " + e.getReturnCode());
                    log("  Response: " + e.getMessage());
                } else if (me instanceof SMTPAddressSucceededException) {
                    log("ADDRESS SUCCEEDED:");
                    SMTPAddressSucceededException e = (SMTPAddressSucceededException)me;
                    log(e.toString());
                    log("  Address: " + e.getAddress());
                    log("  Command: " + e.getCommand());
                    log("  RetCode: " + e.getReturnCode());
                    log("  Response: " + e.getMessage());
                }
            }
        }
    }
View Full Code Here

                MessagingException me = sfe;
                Exception ne;
                while ((ne = me.getNextException()) != null && ne instanceof MessagingException) {
                    me = (MessagingException)ne;
                    if (me instanceof SMTPAddressFailedException) {
                        SMTPAddressFailedException ssfe = (SMTPAddressFailedException)me;
                        deleteMessage = (ssfe.getReturnCode() >= 500 && ssfe.getReturnCode() <= 599);
                    }
                }
            }

            // log the original set of intended recipients
            if (isDebug) log("Recipients: " + recipients);

            if (sfe.getInvalidAddresses() != null) {
                Address[] address = sfe.getInvalidAddresses();
                if (address.length > 0) {
                    recipients.clear();
                    for (int i = 0; i < address.length; i++) {
                        try {
                            recipients.add(new MailAddress(address[i].toString()));
                        } catch (ParseException pe) {
                            // this should never happen ... we should have
                            // caught malformed addresses long before we
                            // got to this code.
                            log("Can't parse invalid address: " + pe.getMessage());
                        }
                    }
                    if (isDebug) log("Invalid recipients: " + recipients);
                    deleteMessage = failMessage(mail, sfe, true);
                }
            }

            if (sfe.getValidUnsentAddresses() != null) {
                Address[] address = sfe.getValidUnsentAddresses();
                if (address.length > 0) {
                    recipients.clear();
                    for (int i = 0; i < address.length; i++) {
                        try {
                            recipients.add(new MailAddress(address[i].toString()));
                        } catch (ParseException pe) {
                            // this should never happen ... we should have
                            // caught malformed addresses long before we
                            // got to this code.
                            log("Can't parse unsent address: " + pe.getMessage());
                        }
                    }
                    if (isDebug) log("Unsent recipients: " + recipients);
                    if (sfe instanceof SMTPSendFailedException) {
                        SMTPSendFailedException ssfe = (SMTPSendFailedException) sfe;
                        deleteMessage = failMessage(mail, sfe, ssfe.getReturnCode() >= 500 && ssfe.getReturnCode() <= 599);
                    } else {
                        deleteMessage = failMessage(mail, sfe, false);
                    }
                }
            }
View Full Code Here

            }
            Exception ne;
            while ((ne = me.getNextException()) != null && ne instanceof MessagingException) {
                me = (MessagingException)ne;
                if (me instanceof SMTPAddressFailedException) {
                    SMTPAddressFailedException e = (SMTPAddressFailedException)me;
                    log("ADDRESS FAILED:");
                    log(e.toString());
                    log("  Address: " + e.getAddress());
                    log("  Command: " + e.getCommand());
                    log("  RetCode: " + e.getReturnCode());
                    log("  Response: " + e.getMessage());
                } else if (me instanceof SMTPAddressSucceededException) {
                    log("ADDRESS SUCCEEDED:");
                    SMTPAddressSucceededException e = (SMTPAddressSucceededException)me;
                    log(e.toString());
                    log("  Address: " + e.getAddress());
                    log("  Command: " + e.getCommand());
                    log("  RetCode: " + e.getReturnCode());
                    log("  Response: " + e.getMessage());
                }
            }
        }
    }
View Full Code Here

                MessagingException me = sfe;
                Exception ne;
                while ((ne = me.getNextException()) != null && ne instanceof MessagingException) {
                    me = (MessagingException)ne;
                    if (me instanceof SMTPAddressFailedException) {
                        SMTPAddressFailedException ssfe = (SMTPAddressFailedException)me;
                        deleteMessage = (ssfe.getReturnCode() >= 500 && ssfe.getReturnCode() <= 599);
                    }
                }
            }

            // log the original set of intended recipients
            if (isDebug) log("Recipients: " + recipients);

            if (sfe.getInvalidAddresses() != null) {
                Address[] address = sfe.getInvalidAddresses();
                if (address.length > 0) {
                    recipients.clear();
                    for (int i = 0; i < address.length; i++) {
                        try {
                            recipients.add(new MailAddress(address[i].toString()));
                        } catch (ParseException pe) {
                            // this should never happen ... we should have
                            // caught malformed addresses long before we
                            // got to this code.
                            log("Can't parse invalid address: " + pe.getMessage());
                        }
                    }
                    if (isDebug) log("Invalid recipients: " + recipients);
                    deleteMessage = failMessage(mail, sfe, true);
                }
            }

            if (sfe.getValidUnsentAddresses() != null) {
                Address[] address = sfe.getValidUnsentAddresses();
                if (address.length > 0) {
                    recipients.clear();
                    for (int i = 0; i < address.length; i++) {
                        try {
                            recipients.add(new MailAddress(address[i].toString()));
                        } catch (ParseException pe) {
                            // this should never happen ... we should have
                            // caught malformed addresses long before we
                            // got to this code.
                            log("Can't parse unsent address: " + pe.getMessage());
                        }
                    }
                    if (isDebug) log("Unsent recipients: " + recipients);
                    if (sfe instanceof SMTPSendFailedException) {
                        SMTPSendFailedException ssfe = (SMTPSendFailedException) sfe;
                        deleteMessage = failMessage(mail, sfe, ssfe.getReturnCode() >= 500 && ssfe.getReturnCode() <= 599);
                    } else {
                        deleteMessage = failMessage(mail, sfe, false);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of com.sun.mail.smtp.SMTPAddressFailedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.