mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
IMAP: add date header to rebuilt message
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1934 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
7578f854ee
commit
007a328051
@ -2748,6 +2748,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
messageProperties.add(Field.getPropertyName("to"));
|
||||
messageProperties.add(Field.getPropertyName("cc"));
|
||||
messageProperties.add(Field.getPropertyName("subject"));
|
||||
messageProperties.add(Field.getPropertyName("date"));
|
||||
messageProperties.add(Field.getPropertyName("htmldescription"));
|
||||
messageProperties.add(Field.getPropertyName("body"));
|
||||
PropFindMethod propFindMethod = new PropFindMethod(URIUtil.encodePath(message.permanentUrl), messageProperties, 0);
|
||||
@ -2761,6 +2762,10 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
if (propertyValue != null) {
|
||||
mimeMessage.addHeader("Content-class", propertyValue);
|
||||
}
|
||||
propertyValue = getPropertyIfExists(properties, "date");
|
||||
if (propertyValue != null) {
|
||||
mimeMessage.setSentDate(parseDateFromExchange(propertyValue));
|
||||
}
|
||||
propertyValue = getPropertyIfExists(properties, "from");
|
||||
if (propertyValue != null) {
|
||||
mimeMessage.addHeader("From", propertyValue);
|
||||
@ -3063,4 +3068,16 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected Date parseDateFromExchange(String exchangeDateValue) throws DavMailException {
|
||||
Date result = null;
|
||||
if (exchangeDateValue != null) {
|
||||
try {
|
||||
result = getExchangeZuluDateFormatMillisecond().parse(exchangeDateValue);
|
||||
} catch (ParseException e) {
|
||||
throw new DavMailException("EXCEPTION_INVALID_DATE", exchangeDateValue);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -521,12 +521,14 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
getItemMethod.addAdditionalProperty(Field.get("to"));
|
||||
getItemMethod.addAdditionalProperty(Field.get("cc"));
|
||||
getItemMethod.addAdditionalProperty(Field.get("subject"));
|
||||
getItemMethod.addAdditionalProperty(Field.get("date"));
|
||||
getItemMethod.addAdditionalProperty(Field.get("body"));
|
||||
executeMethod(getItemMethod);
|
||||
EWSMethod.Item item = getItemMethod.getResponseItem();
|
||||
|
||||
MimeMessage mimeMessage = new MimeMessage((Session) null);
|
||||
mimeMessage.addHeader("Content-class", item.get(Field.get("contentclass").getResponseName()));
|
||||
mimeMessage.setSentDate(parseDateFromExchange(item.get(Field.get("date").getResponseName())));
|
||||
mimeMessage.addHeader("From", item.get(Field.get("from").getResponseName()));
|
||||
mimeMessage.addHeader("To", item.get(Field.get("to").getResponseName()));
|
||||
mimeMessage.addHeader("Cc", item.get(Field.get("cc").getResponseName()));
|
||||
@ -2186,6 +2188,18 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
protected Date parseDateFromExchange(String exchangeDateValue) throws DavMailException {
|
||||
Date dateValue = null;
|
||||
if (exchangeDateValue != null) {
|
||||
try {
|
||||
dateValue = getExchangeZuluDateFormat().parse(exchangeDateValue);
|
||||
} catch (ParseException e) {
|
||||
throw new DavMailException("EXCEPTION_INVALID_DATE", exchangeDateValue);
|
||||
}
|
||||
}
|
||||
return dateValue;
|
||||
}
|
||||
|
||||
protected String convertDateFromExchange(String exchangeDateValue) throws DavMailException {
|
||||
String zuluDateValue = null;
|
||||
if (exchangeDateValue != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user