mirror of
https://github.com/moparisthebest/davmail
synced 2025-03-01 01:41:52 -05:00
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:
parent
85d730310f
commit
e61d5cbbe5
@ -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
|
||||
|
@ -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 + '/';
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user