SMTPSendFailedException (JavaMail API documentation)
Date: 2016-12-03

com.sun.mail.smtp

## Class SMTPSendFailedException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - javax.mail.MessagingException
      - - javax.mail.SendFailedException
        - - com.sun.mail.smtp.SMTPSendFailedException

- All Implemented Interfaces:
    java.io.Serializable

      public class SMTPSendFailedException
      extends SendFailedException

  This exception is thrown when the message cannot be sent.

  This exception will usually appear first in a chained list of exceptions, followed by SMTPAddressFailedExceptions and/or SMTPAddressSucceededExceptions, * one per address. This exception corresponds to one of the SMTP commands used to send a message, such as the MAIL, DATA, and "end of data" commands, but not including the RCPT command.

  Since:
    JavaMail 1.3.2
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected InternetAddress` | `addr`
    `protected java.lang.String` | `cmd`
    `protected int` | `rc`

    - ### Fields inherited from class javax.mail.SendFailedException

      `invalid, validSent, validUnsent`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SMTPSendFailedException(java.lang.String cmd, int rc, java.lang.String err, java.lang.Exception ex, Address[] vs, Address[] vus, Address[] inv)` Constructs an SMTPSendFailedException with the specified address, return code, and error string.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getCommand()` Return the command that failed.
    `int` | `getReturnCode()` Return the return code from the SMTP server that indicates the reason for the failure.

    - ### Methods inherited from class javax.mail.SendFailedException

      `getInvalidAddresses, getValidSentAddresses, getValidUnsentAddresses`

    - ### Methods inherited from class javax.mail.MessagingException

      `getCause, getNextException, setNextException, toString`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### addr

          protected InternetAddress addr

    - #### cmd

          protected java.lang.String cmd

    - #### rc

          protected int rc

  - ### Constructor Detail

    - #### SMTPSendFailedException

          public SMTPSendFailedException(java.lang.String cmd,
                                 int rc,
                                 java.lang.String err,
                                 java.lang.Exception ex,
                                 Address[] vs,
                                 Address[] vus,
                                 Address[] inv)

      Constructs an SMTPSendFailedException with the specified address, return code, and error string.
      Parameters:
        `cmd` - the command that was sent to the SMTP server
        `rc` - the SMTP return code indicating the failure
        `err` - the error string from the SMTP server
        `ex` - a chained exception
        `vs` - the valid addresses the message was sent to
        `vus` - the valid addresses the message was not sent to
        `inv` - the invalid addresses

  - ### Method Detail

    - #### getCommand

          public java.lang.String getCommand()

      Return the command that failed.
      Returns:
        the command

    - #### getReturnCode

          public int getReturnCode()

      Return the return code from the SMTP server that indicates the reason for the failure. See RFC 821 for interpretation of the return code.
      Returns:
        the return code

Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms< /a>.