sieve: Add examples#1501
Open
cmouse wants to merge 1 commit intodovecot:mainfrom
Open
Conversation
sirainen
requested changes
Apr 21, 2026
| } | ||
| ``` | ||
|
|
||
| This example discards duplicate messages based on the default message ID tracking. |
Contributor
There was a problem hiding this comment.
How about "default Message-ID header based tracking.
| fileinto "Inbox"; | ||
| ``` | ||
|
|
||
| This example uses the `Message-ID` header explicitly and files duplicate |
Contributor
There was a problem hiding this comment.
Lets use some example that makes more sense. ChatGPT suggests:
require ["duplicate", "imap4flags"];
# If the subject starts with "ALERT:", check for duplicates based on the full subject
if header :matches "Subject" "ALERT: *" {
if duplicate :seconds 60 :header "Subject" {
setflag "\\seen";
}
}
|
|
||
| if string :contains "${subject}" "report" { | ||
| fileinto "Reports"; | ||
| } |
Contributor
There was a problem hiding this comment.
This example's usage of variables extension is rather unnecessary, since it could be directly matching the subject. ChatGPT suggests:
require ["variables", "header", "fileinto"];
# 1. Use wildcards to capture the tag inside brackets
# Example: "[Support] Help needed" matches "Support" into ${1}
if header :matches "Subject" "[*] *" {
# 2. Normalize the tag to lowercase
set :lower "tag" "${1}";
# 3. Use an explicit list to ensure you only file into existing folders
if string :is "${tag}" ["urgent", "receipts", "travel"] {
fileinto "Folders/${tag}";
}
}
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.
JIRA: DOV-8101