mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-05 18:58:02 -05:00
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
This commit is contained in:
parent
e195a5f5c8
commit
bcc1067b89
@ -584,6 +584,7 @@ public class ExchangeSession {
|
|||||||
public String htmlBody;
|
public String htmlBody;
|
||||||
public String contentClass;
|
public String contentClass;
|
||||||
public boolean hasAttachment;
|
public boolean hasAttachment;
|
||||||
|
public boolean hasInlineAttachment;
|
||||||
public String to;
|
public String to;
|
||||||
public String cc;
|
public String cc;
|
||||||
public String date;
|
public String date;
|
||||||
@ -660,11 +661,12 @@ public class ExchangeSession {
|
|||||||
// patch exchange Content type
|
// patch exchange Content type
|
||||||
if (line.equals(CONTENT_TYPE_HEADER + "application/ms-tnef;")) {
|
if (line.equals(CONTENT_TYPE_HEADER + "application/ms-tnef;")) {
|
||||||
if (hasAttachment) {
|
if (hasAttachment) {
|
||||||
|
// trigger attachments load
|
||||||
|
loadAttachments();
|
||||||
boundary = "----_=_NextPart_001_" + uid;
|
boundary = "----_=_NextPart_001_" + uid;
|
||||||
String contentType = "multipart/mixed";
|
String contentType = "multipart/mixed";
|
||||||
// use multipart/related with inline images
|
// use multipart/related with inline images
|
||||||
if (htmlBody != null && (htmlBody.indexOf("src=\"cid:") > 0 ||
|
if (hasInlineAttachment) {
|
||||||
htmlBody.indexOf("src=\"1_multipart") > 0)) {
|
|
||||||
contentType = "multipart/related";
|
contentType = "multipart/related";
|
||||||
}
|
}
|
||||||
line = CONTENT_TYPE_HEADER + contentType + ";\n\tboundary=\"" + boundary + "\"";
|
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
|
// use owa generated body to look for inline images
|
||||||
List<Attribute> imgList = xmlDocument.getNodes("//img/@src");
|
List<Attribute> imgList = xmlDocument.getNodes("//img/@src");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user