Reputation: 2340
I'm writing a mail client using javamail. I followed the example in javamail-samples folder but the CommandInfo is just null for all mails retrieved. As a way of debugging, I wrote the following code:
Session session = Session.getDefaultInstance(props,null);
//get store object
Store store = session.getStore("imaps");
store.connect("imap.gmail.com", "email", "password");
System.out.println(store);
//create folder
Folder inbox = store.getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
Message [] messages = inbox.getMessages();
for(Message message: messages){
//message.
DataHandler d = message.getDataHandler();
CommandInfo in = d.getCommand("view");
System.out.println(in);
}
The results:
null
null
null
null
null
null
null
....
....
Anyone have an idea why this is so?
Upvotes: 0
Views: 479
Reputation: 29971
It is finding the simple.mailcap file? Usually it should be in the directory where you run the program. Note that there's only a few viewers included with the program. Are you trying to view a simple plain text message?
Upvotes: 1