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;
|
private final String userName;
|
||||||
|
|
||||||
|
protected String serverVersion;
|
||||||
|
|
||||||
protected static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss";
|
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'";
|
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'";
|
protected static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||||
@ -1053,15 +1055,9 @@ public abstract class ExchangeSession {
|
|||||||
convertResentHeader(mimeMessage, "Message-Id");
|
convertResentHeader(mimeMessage, "Message-Id");
|
||||||
|
|
||||||
// fix From header for Exchange 2007
|
// fix From header for Exchange 2007
|
||||||
Address[] fromAddresses = mimeMessage.getFrom();
|
if (!"Exchange2003".equals(serverVersion)) {
|
||||||
|
|
||||||
if (fromAddresses != null) {
|
|
||||||
for (Address fromAddress : fromAddresses) {
|
|
||||||
if (!email.equalsIgnoreCase(((InternetAddress) fromAddress).getAddress())) {
|
|
||||||
mimeMessage.removeHeader("From");
|
mimeMessage.removeHeader("From");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove visible recipients from list
|
// remove visible recipients from list
|
||||||
Set<String> visibleRecipients = new HashSet<String>();
|
Set<String> visibleRecipients = new HashSet<String>();
|
||||||
|
@ -475,6 +475,7 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
//noinspection VariableNotUsedInsideIf
|
//noinspection VariableNotUsedInsideIf
|
||||||
if (mailPath != null) {
|
if (mailPath != null) {
|
||||||
// Exchange 2003
|
// Exchange 2003
|
||||||
|
serverVersion = "Exchange2003";
|
||||||
try {
|
try {
|
||||||
buildEmail(method.getURI().getHost());
|
buildEmail(method.getURI().getHost());
|
||||||
} catch (URIException uriException) {
|
} catch (URIException uriException) {
|
||||||
@ -482,6 +483,11 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Exchange 2007 : get alias and email from options page
|
// Exchange 2007 : get alias and email from options page
|
||||||
|
serverVersion = "Exchange2007";
|
||||||
|
|
||||||
|
// Gallookup is an Exchange 2003 only feature
|
||||||
|
disableGalLookup = true;
|
||||||
|
|
||||||
getEmailAndAliasFromOptions();
|
getEmailAndAliasFromOptions();
|
||||||
// build standard mailbox link with email
|
// build standard mailbox link with email
|
||||||
mailPath = "/exchange/" + email + '/';
|
mailPath = "/exchange/" + email + '/';
|
||||||
|
@ -50,7 +50,6 @@ import java.util.*;
|
|||||||
public class EwsExchangeSession extends ExchangeSession {
|
public class EwsExchangeSession extends ExchangeSession {
|
||||||
|
|
||||||
protected Map<String, String> folderIdMap;
|
protected Map<String, String> folderIdMap;
|
||||||
protected String serverVersion;
|
|
||||||
|
|
||||||
protected class Folder extends ExchangeSession.Folder {
|
protected class Folder extends ExchangeSession.Folder {
|
||||||
public FolderId folderId;
|
public FolderId folderId;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user