Retrieving Email Messages

So far, today's lesson has concentrated on sending email messages, but the JavaMail API provides support for other common email operations, such as retrieving messages and attachments and deleting messages on the server. The remainder of today's lesson gives you an introduction to these operations.

Retrieving Simple Messages

Earlier in today's lesson, you saw that the most prevalent message-retrieval protocols are POP3 and IMAP. The application you are about to build uses POP3 to retrieve messages from a mail server. Note that because you work with an abstraction of a mail system, the technique for accessing a mailbox with IMAP is very similar.

Figure 11.3 shows the process for retrieving messages.

Figure 11.3. The message ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.