The InboxEmailsReader is a new class introduced in the JavaEmailer library 0.2 to let Java application projects check email accounts inbox folders for incoming messages to automatically detect undelivered mails and update mailing lists to avoid wasting time sending emails that will never reach recipients during next mass mailing operations.

// Sample program package
package javatestlab;
// For reading text files
import ejel.*;
import ejel.EventManager.EventID;
import java.io.IOException;
import javax.mail.*;
import java.util.*;
/**
 *
 * @author emmr.rida
 */
public class Main
{
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws NoSuchProviderException, MessagingException, IOException, InterruptedException
    {
        asyncSample(); // Uncomment to use non blocking services
        //syncSample(); // Uncomment to use blocking services
    }
    /**
     * Sample code of the InboxEmailsReader that uses blocking services to connect to an email account and search for email messages
     * @throws NoSuchProviderException
     * @throws MessagingException
     * @throws IOException
     */
    private static void syncSample() throws NoSuchProviderException, MessagingException, IOException
    {
        // Email account login information
        EmailAccount account = new EmailAccount("user@host.com", "password", "server_host_name", 0, true, EmailAccount.ServerProtocol.IMAP);
        // Constructs an object that will look for emails whose subject contains [Re :]
        InboxEmailsReader reader = new InboxEmailsReader(account, "Re :", false, new Flags());
        System.out.println("Connecting to server...");
        if(reader.connect()) { // Connect to server
            System.out.println("Connected to the server.");
            Iterator it = reader.iterator(); // Get the iterator
            while(it.hasNext()) { // While there are more Message objects
                Message msg = (Message)it.next(); // Retrieve the Message email object
                System.out.println(msg.getFrom()[0].toString() + " | " + msg.getSubject() + " | " + msg.getSentDate().toString());
            }
            reader.close(); // Cose the reader
        } else { // Error
            if(reader.getException() != null) reader.getException().printStackTrace();
        }
        System.out.println("Program terminated.");
    }
    /**
     * Sample code of the InboxEmailsReader that uses non blocking services to connect to an email account and search for email messages
     * @throws NoSuchProviderException
     * @throws MessagingException
     * @throws IOException
     * @throws InterruptedException
     */
    private static void asyncSample() throws NoSuchProviderException, MessagingException, IOException, InterruptedException
    {
        // The email account login information
        EmailAccount account = new EmailAccount("user@host", "password", "host_name", 0, true, EmailAccount.ServerProtocol.POP3);
        // Constructs an InboxEmailsReader and search for emails whose subjects matches the regular expressions
        InboxEmailsReader reader = new InboxEmailsReader(account, "Re[\\s]{0,1}:.*", true, new Flags());
        // Constructs a listener object
        MyEventListener listener = new MyEventListener();
        // Register the listener for the right event
        reader.registerEventListener(EventID.EID_NEXT_INBOX_EMAIL, listener);
        System.out.print("Connecting to server");
        reader.asyncConnect(); // Try to connect to server
        while(reader.isNowConnecting()) { // Wait for the connection
            System.out.print('.');
            Thread.sleep(250);
        }
        System.out.println('.');
        if(reader.isConnected()) { // Check success
            System.out.println("Connected to server.");
        }  else {
            reader.getException().printStackTrace();
            return;
        }
        // After the call a thread will be created and the search process begins.
        // For every email message that matches the search query, an event is
        // raised so as the registered listeners will check the email message.
        reader.asyncIterator();
        while(reader.isIterating()) Thread.sleep(250); // Wait for the search process to finish
        reader.close(); // Close the reader
        System.out.println("Program terminated.");
    }
}
/**
 * Here's our simple listener for the InboxEmailsReader events
 * must implement the EventListener
 * @author emmr.rida
 */
class MyEventListener implements ejel.EventListener
{
    /**
     * The asynchronous search process will raise the EventID.EID_NEXT_INBOX_EMAIL
     * event for each emai message found and call that function to process the email message
     * @param sender The InboxEmailsReader object who raised the event
     * @param evtId The event ID
     * @param evtParams Params for the event
     */
    public void eventListener(Object sender, EventID evtId, EventArgs evtParams) {
        if(evtId == EventID.EID_NEXT_INBOX_EMAIL) {
            NextInboxEmailEventArgs ea = (NextInboxEmailEventArgs)evtParams;
            try {
                System.out.println(ea.getMessage().getFrom()[0].toString() + " | " + ea.getMessage().getSubject() + " | " + ea.getMessage().getSentDate().toString());
                //ea.setAbortStatus(); // To abort the asynchronous search process
            } catch(Exception ex) {
                System.out.println(ex.getMessage());
            }
        } else assert false : "That must never happens!";
    }
}

Best regards :)