On Apr 15, 6:30 pm, Lew <l...@nospam.lewscanon.com> wrote:
Nikhil wrote:
public class PopTest2
{
private static final String SMTP_HOST_NAME = "smtp.gmail.com";
Your post would be much easier to follow if you did not embed TAB characters
in it.
...
Message[] msg = folder.getMessages();
...
System.out.println("\nFrom-------------------> "+msg[i].getFrom());
...
And following is the output :(of only one of the many mails of the
account)
,,,
From------------------->[Ljavax.mail.internet.InternetAddress;@13582d
Well, of course we don't have the definition of Message in front of us, since
you didn't post an SSCCE, but dollars to doughnuts getFrom() doesn't return a
String. In fact, I will bet good money it returns a
javax.mail.internet.InternetAddress.
What is the type of Message.getFrom()?
(Hint: javax.mail.internet.InternetAddress)
What is the default output from toString() if one doesn't override it?
(Hint:
<http://java.sun.com/javase/6/docs/api/java/lang/Object.html#toString()>
--
Lew
Thanks for replying....
Actually the getFrom method returns an array of type
javax.mail.internet.InternetAddress .
So now when i wrote the following statement, it printed the correct
address.
(msg[i].getRecipients(Message.RecipientType.TO))[0].toString()
But still I am not able to read the contents of the Messages whose
content type is MimeMultipart.
So how do I read contents of these messages?
You should be able to figure that out from the API documentation. Note
actual message. One part may be text/html (or application/html), another
may be text/plain. It's all spelled out in the headers and the class
hierarchy. Note also that text may be encoded in, e g, Quoted Printable
or Base64. The header fields may also be encoded, if they contain