can you post the messagebody you select from the db?
On 12/15/06, Gino <[EMAIL PROTECTED]> wrote:
Hi.
thank you for your reply.
I think the message body is the problem,I don't think it is well
formed.Actually This is the just question puzzled me.why the message I create
by that way isn't well formed? following is my parse program.
public static void parseMailContent(Part part, StringBuffer bodyText,
StringBuffer bodyHtml) throws Exception {
String contentType = part.getContentType();
int nameIndex = contentType.indexOf("name");
boolean conname = false;
if (nameIndex != -1)
conname = true;
if (part.isMimeType("text/plain") && !conname) {
bodyText.append((String) part.getContent());
} else if (part.isMimeType("text/html") && !conname) {
bodyHtml.append((String) part.getContent());
} else if (part.isMimeType("multipart/*")) {
Multipart multipart = (Multipart) part.getContent();
int counts = multipart.getCount();////////////Exception happen
here!!
for (int i = 0; i < counts; i++) {
parseMailContent(multipart.getBodyPart(i), bodyText, bodyHtml);
}
} else if (part.isMimeType("message/rfc822")) {
parseMailContent((Part) part.getContent(), bodyText, bodyHtml);
}
}
Gino
2006-12-14
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]