Class POP3Store

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Direct Known Subclasses:
    POP3SSLStore

    public class POP3Store
    extends Store
    A POP3 Message Store. Contains only one folder, "INBOX". See the com.sun.mail.pop3 package documentation for further information on the POP3 protocol provider.

    • Constructor Detail

      • POP3Store

        public POP3Store​(Session session,
                         URLName url,
                         java.lang.String name,
                         boolean isSSL)
    • Method Detail

      • isConnected

        public boolean isConnected()
        Check whether this store is connected. Override superclass method, to actually ping our server connection.
        Overrides:
        isConnected in class Service
        Returns:
        true if the service is connected, false if it is not connected
      • close

        public void close()
                   throws MessagingException
        Description copied from class: Service
        Close this service and terminate its connection. A close ConnectionEvent is delivered to any ConnectionListeners. Any Messaging components (Folders, Messages, etc.) belonging to this service are invalid after this service is closed. Note that the service is closed even if this method terminates abnormally by throwing a MessagingException.

        This implementation uses setConnected(false) to set this service's connected state to false. It will then send a close ConnectionEvent to any registered ConnectionListeners. Subclasses overriding this method to do implementation specific cleanup should call this method as a last step to insure event notification, probably by including a call to super.close() in a finally clause.

        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class Service
        Throws:
        MessagingException - for errors while closing
        See Also:
        ConnectionEvent
      • getDefaultFolder

        public Folder getDefaultFolder()
                                throws MessagingException
        Description copied from class: Store
        Returns a Folder object that represents the 'root' of the default namespace presented to the user by the Store.
        Specified by:
        getDefaultFolder in class Store
        Returns:
        the root Folder
        Throws:
        MessagingException - for other failures
      • getFolder

        public Folder getFolder​(java.lang.String name)
                         throws MessagingException
        Only the name "INBOX" is supported.
        Specified by:
        getFolder in class Store
        Parameters:
        name - The name of the Folder. In some Stores, name can be an absolute path if it starts with the hierarchy delimiter. Else it is interpreted relative to the 'root' of this namespace.
        Returns:
        Folder object
        Throws:
        MessagingException - for other failures
        See Also:
        Folder.exists(), Folder.create(int)
      • getFolder

        public Folder getFolder​(URLName url)
                         throws MessagingException
        Description copied from class: Store
        Return a closed Folder object, corresponding to the given URLName. The store specified in the given URLName should refer to this Store object.

        Implementations of this method may obtain the name of the actual folder using the getFile() method on URLName, and use that name to create the folder.

        Specified by:
        getFolder in class Store
        Parameters:
        url - URLName that denotes a folder
        Returns:
        Folder object
        Throws:
        MessagingException - for other failures
        See Also:
        URLName
      • capabilities

        public java.util.Map<java.lang.String,​java.lang.String> capabilities()
                                                                            throws MessagingException
        Return a Map of the capabilities the server provided, as per RFC 2449. If the server doesn't support RFC 2449, an emtpy Map is returned. The returned Map can not be modified. The key to the Map is the upper case capability name as a String. The value of the entry is the entire String capability line returned by the server.

        For example, to check if the server supports the STLS capability, use: if (store.capabilities().containsKey("STLS")) ...

        Returns:
        Map of capabilities
        Throws:
        MessagingException - for failures
        Since:
        JavaMail 1.4.3
      • isSSL

        public boolean isSSL()
        Is this POP3Store using SSL to connect to the server?
        Returns:
        true if using SSL
        Since:
        JavaMail 1.4.6