Retrieving all email messages |
Upon establishing a connection to a POP3 server you can retrieve all messages in the account mailbox by invoking the Pop#getMessages method. Any messages found will be returned as a java.util.Enumeration of type com.jscape.inet.email.EmailMessage.
Example
// establish connection pop.connect();
// get messages in mailbox Enumeration e = pop.getMessages();
// loop thru all messages in mailbox while(e.hasMoreElements()) { EmailMessage message = (EmailMessage)e.nextElement(); // print out subject System.out.println(message.getSubject()); }
See also
|