java - JavaMail - Parsing email content, can't seem to get it to work! (Message.getContent()) -


for few weeks have been developing email client android, have been ignoring parsing email content while have never been able work. thus, time has come ask help!

i have been looking around , have come across few methods have tried never had success with! closest attempt have be:

private string parsecontent(message m) throws exception {            //multipart mp = (multipart)c;     //int j = mp.getcount();      /*for (int = 0; < mp.getcount(); i++)     {         part part = mp.getbodypart(i);         system.out.println(((mimemessage)m).getcontent());         content = content + part.tostring();         //system.out.println((string)part.getcontent());     }*/      object content = m.getcontent();     string contentreturn = null;      if (content instanceof string)      {         contentreturn = (string) content;     }      else if (content instanceof multipart)      {         multipart multipart = (multipart) content;         bodypart part = multipart.getbodypart(0);         part.tostring();         contentreturn = part.getcontent().tostring();     }        return contentreturn; } 

but not work , gibberish such "javax.mail.internet.mimemultipart@44f12450".

can see going wrong?

thanks, rhys

none of above suggestions valid. don't need complex here. mimemessage has got message.writeto(outputstream);

all need print message is:

message.writeto(system.out); 

the above code print actual mime message console (or can use logger).

save content .eml , can open in outlook. simple that!


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -