SMTP: always remove From header with Exchange 2007 and 2010

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1404 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-01 07:03:34 +00:00
parent 85d730310f
commit e61d5cbbe5
3 changed files with 10 additions and 9 deletions

View File

@ -119,6 +119,8 @@ public abstract class ExchangeSession {
private final String userName;
protected String serverVersion;
protected static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss";
private static final String YYYYMMDD_T_HHMMSS_Z = "yyyyMMdd'T'HHmmss'Z'";
protected static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
@ -1053,14 +1055,8 @@ public abstract class ExchangeSession {
convertResentHeader(mimeMessage, "Message-Id");
// fix From header for Exchange 2007
Address[] fromAddresses = mimeMessage.getFrom();
if (fromAddresses != null) {
for (Address fromAddress : fromAddresses) {
if (!email.equalsIgnoreCase(((InternetAddress) fromAddress).getAddress())) {
mimeMessage.removeHeader("From");
}
}
if (!"Exchange2003".equals(serverVersion)) {
mimeMessage.removeHeader("From");
}
// remove visible recipients from list

View File

@ -475,6 +475,7 @@ public class DavExchangeSession extends ExchangeSession {
//noinspection VariableNotUsedInsideIf
if (mailPath != null) {
// Exchange 2003
serverVersion = "Exchange2003";
try {
buildEmail(method.getURI().getHost());
} catch (URIException uriException) {
@ -482,6 +483,11 @@ public class DavExchangeSession extends ExchangeSession {
}
} else {
// Exchange 2007 : get alias and email from options page
serverVersion = "Exchange2007";
// Gallookup is an Exchange 2003 only feature
disableGalLookup = true;
getEmailAndAliasFromOptions();
// build standard mailbox link with email
mailPath = "/exchange/" + email + '/';

View File

@ -50,7 +50,6 @@ import java.util.*;
public class EwsExchangeSession extends ExchangeSession {
protected Map<String, String> folderIdMap;
protected String serverVersion;
protected class Folder extends ExchangeSession.Folder {
public FolderId folderId;