Created
November 22, 2022 08:10
-
-
Save jordanisaacs/9a6aa25a128cb9c0a47cf8a43193fbfc to your computer and use it in GitHub Desktop.
Fastmail Sieve Folders
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
if not string :is "${stop}" "Y" | |
{ | |
### @xxx.com rules | |
if address :all :matches ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "*@xxx.com" | |
{ | |
if string :is ["deltachat"] "${1}" { | |
fileinto "INBOX.DeltaChat"; | |
} | |
else { | |
fileinto :copy "INBOX.INBOX.personal"; | |
if string :is ["folder1", "folder2"] "${1}" { | |
fileinto :copy "INBOX.INBOX.personal.${1}"; | |
} | |
else { | |
fileinto :copy "INBOX.INBOX.personal.catchall"; | |
} | |
} | |
} | |
### @xx.yyy.com rules | |
if address :domain :is ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "xx.yyy.com" { | |
fileinto "INBOX.INBOX.xx"; | |
} | |
if address :all :matches ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "*@fastmail.com" { | |
fileinto :copy "INBOX.INBOX.fastmail"; | |
if string :is "ggg" "${1}" { | |
fileinto :copy "INBOX.INBOX.fastmail.ggg"; | |
} | |
elsif string :is "fff" "${1}" { | |
fileinto :copy "INBOX.INBOX.fastmail.fff"; | |
} | |
} | |
### School email rules | |
elsif address :all :is ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "[email protected]" | |
{ | |
fileinto :copy "INBOX.INBOX.school"; | |
} | |
### Work email rules | |
elsif address :all :is ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "[email protected]" | |
{ | |
fileinto :copy "INBOX.INBOX.work"; | |
} | |
### Labels receipt emails | |
if address :localpart :regex ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "^receipt.*" | |
{ | |
fileinto :copy "INBOX.receipt"; | |
} | |
### Labels throwaway emails | |
elsif address :localpart :regex ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "^throwaway.*" | |
{ | |
fileinto :copy "INBOX.throwaway"; | |
} | |
### Folder matching: "{1}/{2}" or "{1}-{2}" and files them | |
elsif address :localpart :regex ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "^(([A-z]|[0-9])+)(\\/|-)(([A-z]|[0-9])+)" { | |
fileinto :copy "INBOX.${1}"; | |
fileinto :copy "INBOX.${1}.${4}"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 57 for folder hierarchy