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