Stack Exchange
I am getting exception while reading pop3 mail
I have a problem while reading pop3 mail 
and my code is very simple..
Properties objServerProp = new Properties();
objServerProp.setProperty("mail.transport.protocol", "pop3");
objServerProp.setProperty("mail.host", "xxx.xx-ip.org");
objServerProp.put("imap.mail.port", "110");
objServerProp.put("imap.mail.auth", "true");

Session  objSession = Session.getDefaultInstance(objServerProp, null);
Store instStore = objSession.getStore("pop3");
instStore.connect("xxx.xx-ip.org", Integer.valueOf(110), "id", "pwd");
Folder  objFolder = instStore.getFolder("inbox");
objFolder.open(Folder.READ_WRITE);
int count = objFolder.getMessageCount();

 Message objMessage = objFolder.getMessage(1);
 System.out.println("objMessage is :: "+objMessage);
 System.out.println("  message contenttype :: " + objMessage.getContentType());

when i am calling any method ( like :getContentType() ) on message object i am getting below exception,,, 
and the message object is coming fine as 
objMessage is :: com.sun.mail.pop3.POP3Message@37d8d2

Exception is below..
javax.mail.MessagingException: error loading POP3 headers;
  nested exception is:
    java.io.IOException: Unexpected response: 
    at com.sun.mail.pop3.POP3Message.loadHeaders(POP3Message.java:467)
    at com.sun.mail.pop3.POP3Message.getSize(POP3Message.java:106)
    at in10sbouncemailtracker.BMTServer.checkBouncedMails(BMTServer.java:232)
    at BMTMain.main(BMTMain.java:18)
Caused by: java.io.IOException: Unexpected response: 
    at com.sun.mail.pop3.Protocol.simpleCommand(Protocol.java:361)
    at com.sun.mail.pop3.Protocol.multilineCommand(Protocol.java:373)
    at com.sun.mail.pop3.Protocol.top(Protocol.java:271)
    at com.sun.mail.pop3.POP3Message.loadHeaders(POP3Message.java:451)
... 3 more


Really - you didn't get an answer with in a minute and you are already bugging?

Which is line number 18 here??

18 line is in caller method, problem is in called method and
problem is while calling any method on objMessage object..
when i calling objMessage.getContentType() i am getting above exceptions

As described in the JavaMail FAQ, turn on session debugging.  The protocol trace will show you what the unexpected response is.  You should also look at the properties described in the com.sun.mail.pop3 package javadocs, some of them might be useful for working around bugs in your server.
