javamail

A Scala email client (JavaMail API wrapper) alvin November 3, 2016 - 8:43pm

Here’s some source code for a little Scala email client. It’s nothing much, just a little wrapper that works with the JavaMail API:

Scala, IMAP, SearchTerm, AndTerm, FromStringTerm, SentDateTerm, FlagTerm, and FetchProfile

If you're looking for a simple Scala IMAP client tutorial/example, please follow that link, but if you're interested in some Scala source code that demonstrates IMAP searching with Scala, JavaMail, SearchTerm, AndTerm, FromStringTerm, SentDateTerm, FlagTerm, and FetchProfile, this source code may be for you.

In short, here's what the following Scala IMAP client does:

Using JavaMail with multiple search terms (Yahoo mailbox POP3 searching)

I normally don't share source code that doesn't work, but I just want to make a note here for myself on how to use JavaMail to search for multiple search terms. While the code doesn't currently work, I believe it does show the correct syntax for searching for multiple search terms, and there's just something about the overall JavaMail API (or Yahoo Mail) that I don't understand at this moment.

A JavaMail POP reader example (pop3 reader) alvin November 10, 2011 - 11:58am

While working on a Java application, I found the need for a simple Java mailbox reader. I wanted to be able to scan through one of my POP/POP3 mailboxes for messages, and then do something with those messages.

To that end I created the following example JavaMail POP mailbox reader. It connects to a standard POP/POP3 mailbox, then scans through all the messages in the "Inbox" folder.

Search a JavaMail mailbox for unseen messages alvin November 10, 2011 - 11:52am

While working on a Java application yesterday, I ran into a situation where I needed to search my POP3 mailbox for unseen messages, i.e., email messages I haven't read yet. (I'm adding some "You've got mail" functionality to one of my automated robots.)

Jumping right to the solution, here's the complete source code for a JavaMail example class that demonstrates how to search for unseen (unread) email messages in a POP/POP3 mailbox:

JavaMail NoSuchProviderException problem solved

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:

A Java send mail class - A simple class to simplify sending email

Here's the source code for a simple "Java send mail" class that can simplify the process of sending email messages from Java applications. I've named this class MailAgent, and I'm sharing the source code here for free. I've included a brief usage statement in the Javadoc at the top of the class. Hopefully it's all pretty straightforward, and a decent example of using the JavaMail API to send an email message.

Java mail IMAP list example - List all the email addresses in an IMAP mailbox

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 TreeSet (java.util.TreeSet) in this example. Based on our offline discussion, you mentioned that you really want is this: