From 51f55e8d07adf159579f25ce70c68914939ae96e Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Mon, 28 Oct 2024 18:06:05 -0700 Subject: [PATCH] Enhance sieve logic - Switch from guard statements to case block (via if ... elsif ... else) - Add "X-Original-To" header to list of fields to check when determining receiver - File mail that matches none of the configured addresses under "Mailing Lists" --- .../email-sieve/categorize-by-receiver.sieve | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/projects/email-sieve/categorize-by-receiver.sieve b/projects/email-sieve/categorize-by-receiver.sieve index 0742ff44..c78da74b 100644 --- a/projects/email-sieve/categorize-by-receiver.sieve +++ b/projects/email-sieve/categorize-by-receiver.sieve @@ -3,19 +3,20 @@ require ["include", "environment", "variables", "relational", "comparator-i;asci # Generated: Do not run this script on spam messages if allof (environment :matches "vnd.proton.spam-threshold" "*", spamtest :value "ge" :comparator "i;ascii-numeric" "${1}") { return; } +if address :comparator "i;unicode-casemap" :matches ["To", "Cc", "Bcc", "X-Original-To"] "jafner425*@gmail.com" { fileinto "Gmail.com/jafner425@gmail.com"; return; } -if address :comparator "i;unicode-casemap" :matches ["To", "Cc", "Bcc"] "jafner425*@gmail.com" { fileinto "Gmail.com/jafner425@gmail.com"; return; } +elsif address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc", "X-Original-To"] "joey@jafner.net" { fileinto "Jafner.net/joey@jafner.net"; return; } -if address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc"] "joey@jafner.net" { fileinto "Jafner.net/joey@jafner.net"; return; } +elsif address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc", "X-Original-To"] "noreply@jafner.net" { fileinto "Jafner.net/noreply@jafner.net"; return; } -if address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc"] "noreply@jafner.net" { fileinto "Jafner.net/noreply@jafner.net"; return; } +elsif address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc", "X-Original-To"] "consulting@jafner.net" { fileinto "Jafner.net/consulting@jafner.net"; return; } -if address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc"] "consulting@jafner.net" { fileinto "Jafner.net/consulting@jafner.net"; return; } +elsif address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc", "X-Original-To"] "joey.hafner@pm.me" { fileinto "ProtonMail/joey.hafner@pm.me"; return; } -if address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc"] "joey.hafner@pm.me" { fileinto "ProtonMail/joey.hafner@pm.me"; return; } +elsif address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc", "X-Original-To"] "jafner425@proton.me" { fileinto "ProtonMail/jafner425@proton.me"; return; } -if address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc"] "jafner425@proton.me" { fileinto "ProtonMail/jafner425@proton.me"; return; } +elsif address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc", "X-Original-To"] "jafner425@pm.me" { fileinto "ProtonMail/jafner425@pm.me"; return; } -if address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc"] "jafner425@pm.me" { fileinto "ProtonMail/jafner425@pm.me"; return; } +elsif address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc", "X-Original-To"] "joey@jafner.dev" { fileinto "Jafner.dev/joey@jafner.dev"; return; } -if address :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc"] "joey@jafner.dev" { fileinto "Jafner.dev/joey@jafner.dev"; return; } +else { fileinto "Mailing Lists"; } \ No newline at end of file