Internet Message Access Protocol (IMAP) is a commonly used protocol for retrieving messages from the email servers. In order to access the mailbox from your client applications, you would first need to establish a connection with the IMAP server. To achieve this, this article covershow to connect to an IMAP server using Java. Furthermore, you will learn how to use SOCKS or HTTP proxy and connect to an SSL-enabled IMAP server programmatically.