Created
February 23, 2024 16:27
-
-
Save epilys/bf190ffb0147aa5ab863f7fa886a27da to your computer and use it in GitHub Desktop.
sieve filter to create new List mailboxes according to List-ID value
This file contains 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
#require ["fileinto", "mailbox", "variables", "vnd.dovecot.debug", "regex"]; | |
require ["fileinto", "mailbox", "variables", "regex", "vnd.dovecot.execute"]; | |
if not exists "X-GitHub-Recipient" { | |
if header :regex :comparator "i;octet" "list-id" "(.*)" { | |
#set :lower "listid_raw" "${1}"; | |
execute :input "${1}" :output "listid" "sanitize_name.sh"; | |
fileinto :create "INBOX.Lists.${listid}"; | |
stop; | |
} elsif header :matches :comparator "i;octet" "list-id" "*" { | |
fileinto "INBOX.Lists"; | |
stop; | |
} | |
} | |
if exists "X-GitHub-Recipient" { | |
fileinto "INBOX.github"; | |
stop; | |
} |
This file contains 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
#!/bin/sh | |
export LC_ALL=C | |
tr --squeeze-repeats '[:space:]' '_' | tr --squeeze-repeats '[:punct:]' '-' | tr --squeeze-repeats --delete '[:cntrl:]' '' | tr --squeeze-repeats --delete '[:blank:]' '' | sed -e 's/^[[:punct:]]*//' -e "s/[[:punct:]]*$//g" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment