public void receiveIMAP(String host, String username, String password) {
        // Create empty Properties
        Properties props = new Properties();
        // Get Session
        Session session = Session.getDefaultInstance(props, null);
        // Get Store
        try {
            Store store = session.getStore("imap");
            store.connect(host, username, password);

            // Get Folder
            Folder folder = store.getFolder("INBOX");
            folder.open(Folder.READ_ONLY);

            // Get Directory
            Message message[] = folder.getMessages();

            for (int i = 0, n = message.length; i < n; i++) {
                System.out.println(i + ": " + message[i].getFrom()[0] + "   " + message[i].getSubject());
            }
            // Close connection
            folder.close(false);
            store.close();
        } catch (NoSuchProviderException e) {
            e.printStackTrace();
        } catch (MessagingException e) {
            e.printStackTrace();
        }
    }