In addition to allowing programs to create and send messages, the JavaMail API also provides facilities to retrieve incoming messages. This is done via a “message store.” For standard Internet mail, the message store is generally held on a mail server and accessed via a mail client protocol.
The JavaMail 1.2 distribution includes message store implementations for POP3 and IMAP mail client protocols. POP3 is an older protocol that is still used by most ISPs and many corporate environments. It allows clients to list all available messages, retrieve them, and delete them. POP, which stands for “Post Office Protocol,” was designed to work like a post office, acting as a central clearinghouse for incoming messages and providing a mechanism to deliver those messages to the recipient.
POP3 stops at the point of message delivery. IMAP, however, is a newer protocol that allows more complex message handling. IMAP clients can organize messages into different “folders” on the server, based on user commands or built-in server filtering rules. In some implementations, the IMAP server is intended as the final repository for all of a user’s messages. The mail client simply accesses the IMAP folders and retrieves message information as required
Message stores are accessed via
implementations of the
used to retrieve a
getStore( ) provides a variety of ways to specify the desired message retrieval ...