Add recipient-aware Message-ID deduplication - #491
Open
iafred-bot wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an optional recipient-aware Message-ID deduplication mode.
By default, Piler keeps its current behavior: duplicate detection is based on
Message-IDonly. When enabled with:or, in the Docker entrypoint:
a message is considered a duplicate only if an archived message already has the same
Message-ID, the same stored sender, and the exact same recipient set.Use case
When Piler receives an email addressed to a functional/shared mailbox, the initial message is archived correctly and the indexed fields match that first delivery.
On the final mail server hosting that functional mailbox, mailbox forwarding rules may expand the message to the final recipients. When those expanded deliveries come back to Piler, they can currently be treated as duplicates, probably because the
Message-IDis unchanged, even though the recipient is no longer the same as in the original delivery.The impact is that Piler may not archive those expanded deliveries, creating a blind spot for emails received by some users through functional mailbox forwarding.
Behavior
With
deduplicate_messages_by_recipient=1:Message-ID, same sender, same exact recipient set: duplicateMessage-ID, same sender, different recipient set: archived separatelyMessage-ID, different sender: archived separatelyThe default remains
0, so existing installations are unchanged unless they explicitly enable the option.Validation
Tested on Debian 13 runner:
The unit test suite passes, including the new recipient-aware duplicate detection cases.
Prepared by iafred-bot
GitLab: @fredbcode
GitHub: @fredbcode