|
|
@ -64,6 +64,8 @@ import java.io.FileNotFoundException;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.text.DateFormat;
|
|
|
|
import java.text.DateFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Enumeration;
|
|
|
|
import java.util.Enumeration;
|
|
|
@ -77,6 +79,7 @@ import javax.mail.Message;
|
|
|
|
import javax.mail.Multipart;
|
|
|
|
import javax.mail.Multipart;
|
|
|
|
import javax.mail.Part;
|
|
|
|
import javax.mail.Part;
|
|
|
|
import javax.mail.Session;
|
|
|
|
import javax.mail.Session;
|
|
|
|
|
|
|
|
import javax.mail.internet.ContentType;
|
|
|
|
import javax.mail.internet.MimeMessage;
|
|
|
|
import javax.mail.internet.MimeMessage;
|
|
|
|
|
|
|
|
|
|
|
|
public class ActivityEML extends ActivityBase {
|
|
|
|
public class ActivityEML extends ActivityBase {
|
|
|
@ -422,6 +425,35 @@ public class ActivityEML extends ActivityBase {
|
|
|
|
.append(size > 0 ? Helper.humanReadableByteCount(size) : "?")
|
|
|
|
.append(size > 0 ? Helper.humanReadableByteCount(size) : "?")
|
|
|
|
.append('\n');
|
|
|
|
.append('\n');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!part.isMimeType("multipart/*")) {
|
|
|
|
|
|
|
|
Object content = part.getContent();
|
|
|
|
|
|
|
|
if (content instanceof String) {
|
|
|
|
|
|
|
|
String text = (String) content;
|
|
|
|
|
|
|
|
Charset detected = CharsetHelper.detect(text);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String charset;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
ContentType ct = new ContentType(part.getContentType());
|
|
|
|
|
|
|
|
charset = ct.getParameter("charset");
|
|
|
|
|
|
|
|
} catch (Throwable ignored) {
|
|
|
|
|
|
|
|
charset = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (charset == null)
|
|
|
|
|
|
|
|
charset = StandardCharsets.ISO_8859_1.name();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Charset cs = Charset.forName(charset);
|
|
|
|
|
|
|
|
boolean isUtf8 = CharsetHelper.isUTF8(text.getBytes(cs));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < level; i++)
|
|
|
|
|
|
|
|
ssb.append(" ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ssb.append("Detected: ")
|
|
|
|
|
|
|
|
.append(detected == null ? "?" : detected.toString())
|
|
|
|
|
|
|
|
.append(" isUTF8=").append(Boolean.toString(isUtf8))
|
|
|
|
|
|
|
|
.append('\n');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ssb.append('\n');
|
|
|
|
ssb.append('\n');
|
|
|
|
|
|
|
|
|
|
|
|
if (part.isMimeType("multipart/*")) {
|
|
|
|
if (part.isMimeType("multipart/*")) {
|
|
|
|