added inline attachments flag to set Content-Type to multipart/related as needed

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@27 3d1905a2-6b24-0410-a738-b14d5a86fcbd
master
mguessan 17 years ago
parent e195a5f5c8
commit bcc1067b89

@ -584,6 +584,7 @@ public class ExchangeSession {
public String htmlBody;
public String contentClass;
public boolean hasAttachment;
public boolean hasInlineAttachment;
public String to;
public String cc;
public String date;
@ -660,11 +661,12 @@ public class ExchangeSession {
// patch exchange Content type
if (line.equals(CONTENT_TYPE_HEADER + "application/ms-tnef;")) {
if (hasAttachment) {
// trigger attachments load
loadAttachments();
boundary = "----_=_NextPart_001_" + uid;
String contentType = "multipart/mixed";
// use multipart/related with inline images
if (htmlBody != null && (htmlBody.indexOf("src=\"cid:") > 0 ||
htmlBody.indexOf("src=\"1_multipart") > 0)) {
if (hasInlineAttachment) {
contentType = "multipart/related";
}
line = CONTENT_TYPE_HEADER + contentType + ";\n\tboundary=\"" + boundary + "\"";
@ -1149,6 +1151,9 @@ public class ExchangeSession {
}
}
// set inline attachments flag
hasInlineAttachment = (htmlBodyImgList.size() > 0);
// use owa generated body to look for inline images
List<Attribute> imgList = xmlDocument.getNodes("//img/@src");

Loading…
Cancel
Save