Skip to content

Instantly share code, notes, and snippets.

@jordanisaacs
Created November 22, 2022 08:10
Show Gist options
  • Save jordanisaacs/9a6aa25a128cb9c0a47cf8a43193fbfc to your computer and use it in GitHub Desktop.
Save jordanisaacs/9a6aa25a128cb9c0a47cf8a43193fbfc to your computer and use it in GitHub Desktop.
Fastmail Sieve Folders
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}";
}
}
@jordanisaacs
Copy link
Author

Line 57 for folder hierarchy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment