I'm using the java mail api built into java to get the mail of a user from their gmail box, most of the code i found in another SO question. And I'm able to pull most of the information i want correctly, like the subject, senders and other info from my mailbox.
Everything works great except when i go to pull the "content" of the message it doesnt always pull the content of the message. Only like 1 in 10 times it works. The other 9 times it just finds "javax.mail.internet.MimeMultipart@40e9c920"
My code is below. I'm printing the output into LogCat to test. Thanks in advance.
Properties props = System.getProperties();
            Session session = Session.getDefaultInstance(props, null);
            Store store = session.getStore("imaps");
            store.connect("imap.gmail.com", "Email address here",
                    "password here");
            Folder inbox = store.getFolder("Inbox");
            inbox.open(Folder.READ_ONLY);
            Message messages[] = inbox.getMessages();
            for (Message message : messages)
                Log.d("Email", message + "");
            Message message[] = inbox.getMessages();
    
                    for (int i = 0; i < 25; i++) {
                        Log.d("From", message[i].getFrom()[0] + "");
                        Log.d("Subject", message[i].getSubject() + "");
                        String content = message[i].getContent().toString();
                        Log.d("content", content + "");
                        
                    }
Edit: After some additional research I've found it has something to do with reading a multipart email with JavaMail
 
     
     
    