-
Notifications
You must be signed in to change notification settings - Fork 80
sieve: Add examples #1501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
sieve: Add examples #1501
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,3 +41,32 @@ sieve_script personal { | |
| sieve_duplicate_default_period = 1h | ||
| sieve_duplicate_max_period = 1d | ||
| ``` | ||
|
|
||
| ## Sieve Example | ||
|
|
||
| ```sieve | ||
| require ["duplicate"]; | ||
|
|
||
| if duplicate { | ||
| discard; | ||
| stop; | ||
| } | ||
| ``` | ||
|
|
||
| This example discards duplicate messages based on the default message ID tracking. | ||
|
|
||
| ## Advanced Sieve Example | ||
|
|
||
| ```sieve | ||
| require ["duplicate", "fileinto"]; | ||
|
|
||
| if duplicate :header "Message-ID" { | ||
| fileinto "Duplicates"; | ||
| stop; | ||
| } | ||
|
|
||
| fileinto "Inbox"; | ||
| ``` | ||
|
|
||
| This example uses the `Message-ID` header explicitly and files duplicate | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets use some example that makes more sense. ChatGPT suggests: |
||
| messages into a dedicated mailbox instead of discarding them. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,3 +17,20 @@ The variables extension is available by default. | |
| ### Settings | ||
|
|
||
| <SettingsComponent tag="sieve-variables" level="3" /> | ||
|
|
||
| ## Sieve Example | ||
|
|
||
| ```sieve | ||
| require ["variables", "header", "fileinto"]; | ||
|
|
||
| if header :matches "Subject" "*" { | ||
| set "subject" "${1}"; | ||
| } | ||
|
|
||
| if string :contains "${subject}" "report" { | ||
| fileinto "Reports"; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example's usage of variables extension is rather unnecessary, since it could be directly matching the subject. ChatGPT suggests: |
||
| ``` | ||
|
|
||
| This example extracts the Subject header into a variable and files matching | ||
| messages into a folder based on its contents. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "default
Message-IDheader based tracking.