Today I dug into someone else's project to help fix it, and when I got to the part about sending email messages from within the program, I kept getting this JavaMail API exception:
Java Mail (JavaMail) IMAP FAQ: Can you show me how to get a list of all the email addresses in an IMAP mailbox using the Java Mail API (JavaMail API)?
Sure. Here's the source code for a Java mail (JavaMail) program that extracts all of the "from" fields out of a specified mailbox. This works for both POP3 and IMAP mailboxes.
Before going to the code, note the cool use of a
java.util.TreeSet) in this example. Based on our offline discussion, you mentioned that you really want is this: