自己解决!!!
public static String getCid(Part p) throws MessagingException {
String cidraw = null, cid = null;
String[] headers = p.getHeader("Content-id");
if (headers != null && headers.length > 0) {
cidraw = headers[0];
} else {
return null;
}
if (cidraw.startsWith("<") && cidraw.endsWith(">")) {
cid = "cid:" + cidraw.substring(1, cidraw.length() - 1);
} else {
cid = "cid:" + cidraw;
}
return cid; }
public static String getCid(Part p) throws MessagingException {
String cidraw = null, cid = null;
String[] headers = p.getHeader("Content-id");
if (headers != null && headers.length > 0) {
cidraw = headers[0];
} else {
return null;
}
if (cidraw.startsWith("<") && cidraw.endsWith(">")) {
cid = "cid:" + cidraw.substring(1, cidraw.length() - 1);
} else {
cid = "cid:" + cidraw;
}
return cid; }
非常感谢,我都搞了几天了,没有搞定。
非常感谢。
非常感谢
非常感谢