在我的服務器我收到的電子郵件不斷從Gmail ..的MimeMessage電子郵件獲得回覆身體沒有以前函授
我接納他們爲的MimeMessage類型。
我在做什麼,到目前爲止被提取正文與方法:
private String getText(Part p) throws MessagingException, IOException {
if (p.isMimeType("text/*")) {
String s = (String) p.getContent();
return s;
}
if (p.isMimeType("multipart/alternative")) {
// prefer html text over plain text
Multipart mp = (Multipart) p.getContent();
String text = null;
for (int i = 0; i < mp.getCount(); i++) {
Part bp = mp.getBodyPart(i);
if (bp.isMimeType("text/plain")) {
if (text == null)
text = getText(bp);
continue;
} else if (bp.isMimeType("text/html")) {
String s = getText(bp);
if (s != null)
return s;
} else {
return getText(bp);
}
}
return text;
} else if (p.isMimeType("multipart/*")) {
Multipart mp = (Multipart) p.getContent();
for (int i = 0; i < mp.getCount(); i++) {
String s = getText(mp.getBodyPart(i));
if (s != null)
return s;
}
}
return null;
}
我的問題,現在是基於電子郵件,我得到的是「在回答」以前的電子郵件。 當我提取這些電子郵件爲他們的文本我收到「X寫在Y ...」,然後所有以前的信件。 我如何獲得新的回覆文本? (沒有以前的信件)?
謝謝。
謝謝,我有一個預感它是這樣的。 – Urbanleg