MailConnectException (JavaMail API documentation)
Date: 2018-10-22

com.sun.mail.util

## Class MailConnectException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - javax.mail.MessagingException
      - - com.sun.mail.util.MailConnectException

- All Implemented Interfaces:
    java.io.Serializable

      public class MailConnectException
      extends MessagingException

  A MessagingException that indicates a socket connection attempt failed. Unlike java.net.ConnectException, it includes details of what we were trying to connect to. The underlying exception is available as the "cause" of this exception.
  Since:
    JavaMail 1.5.0
  See Also:
    `ConnectException`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MailConnectException(com.sun.mail.util.SocketConnectException cex)` Constructs a MailConnectException.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getConnectionTimeout()` The timeout used for the connection attempt.
    `java.lang.String` | `getHost()` The host we were trying to connect to.
    `int` | `getPort()` The port we were trying to connect to.

    - ### 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`

- - ### Constructor Detail

    - #### MailConnectException

          public MailConnectException(com.sun.mail.util.SocketConnectException cex)

      Constructs a MailConnectException.
      Parameters:
        `cex` - the SocketConnectException with the details

  - ### Method Detail

    - #### getHost

          public java.lang.String getHost()

      The host we were trying to connect to.
      Returns:
        the host

    - #### getPort

          public int getPort()

      The port we were trying to connect to.
      Returns:
        the port

    - #### getConnectionTimeout

          public int getConnectionTimeout()

      The timeout used for the connection attempt.
      Returns:
        the connection timeout

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