1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

SMTP: new duplicate message-id detection implementation, no need to search Sent folder

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1423 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-06 12:54:19 +00:00
parent 6defe86762
commit 447258b45b

View File

@ -1033,6 +1033,8 @@ public abstract class ExchangeSession {
}
}
protected String lastSentMessageId;
/**
* Send message in reader to recipients.
* Detect visible recipients in message body to determine bcc recipients
@ -1043,14 +1045,13 @@ public abstract class ExchangeSession {
* @throws MessagingException on error
*/
public void sendMessage(List<String> rcptToRecipients, MimeMessage mimeMessage) throws IOException, MessagingException {
// check Sent folder for duplicates
if (Settings.getBooleanProperty("davmail.smtpCheckDuplicates")) {
ExchangeSession.MessageList messages = searchMessages(SENT, headerIsEqualTo("message-id", mimeMessage.getMessageID()));
if (!messages.isEmpty()) {
LOGGER.debug("Dropping message id " + mimeMessage.getMessageID() + ": already sent");
return;
}
// detect duplicate send command
String messageId = mimeMessage.getMessageID();
if (lastSentMessageId != null && lastSentMessageId.equals(messageId)) {
LOGGER.debug("Dropping message id " + messageId + ": already sent");
return;
}
lastSentMessageId = messageId;
convertResentHeader(mimeMessage, "From");
convertResentHeader(mimeMessage, "To");