StephenMichel
Lessons learned the hard way
If your script has a syntax error, and parsing reaches that point in the script, mail will simply not be delivered. Always send yourself a test email after making changes.
Probably due to our AFS setup, the only filing syntax that seems to work is fileinto, using an absolute path. keep does not work, including automatic/implicit keep, so you must explicitly fileinto your inbox.
If you just want quick examples, use the section below, fastmail's guide, or ProtonMail's guide. However, if you want to actually understand what you're doing & what's possible, all the various articles out there really suck; fortunately (and surprisingly) rfc 5228 itself is relatively light reading and you'll save yourself a lot of time starting there instead of searching for a more "consumer-facing" explanation.
This is my current filter, with two changes:
- Removed rules that were identical in syntax, just with different values
Changed all domains to example.com, to prevent spambots picking up anyone's email address off this page.
# Sieve filter require ["fileinto"]; if address :contains ["to", "cc", "bcc"] ["admin@example.com", "community@example.com", "privacy@example.com"] { fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/.snowdrift.aliases/"; } elsif address :contains :domain "to" "lists.example.com" { fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/.hcoop/"; } # elsif address :matches ["to", "cc", "bcc"] ["snowdrift@example.com", "snowdrift+*@example.com"] { # fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/.snowdrift/"; # } elsif address :contains ["to", "from", "cc", "bcc"] "board@example.com" { fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/.Board/"; } elsif address :contains "from" "notifications@example.com" { fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/.notifications.GitHub/"; } elsif header :matches "Reply-To" "*@boards.example.com" { fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/.notifications.Trello/"; } elsif address :contains "to" "hnreplies.com@example.com" { fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/.notifications.HN/"; } elsif allof ( address :contains "from" "admin@example.com", header :contains "subject" "[Lutris] Your daily moderator mail" ) { fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/.lutris/"; } else { fileinto "/afs/hcoop.net/user/s/sm/smichel17/Maildir/"; } stop;