From 14732ead0fda42ab64427a392472bb12dead2e0b Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Thu, 15 May 2025 00:41:15 +0100 Subject: [PATCH] fix: simplify sieve script --- applications/email.nix | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/applications/email.nix b/applications/email.nix index 8c49dcd..ec5e2a6 100644 --- a/applications/email.nix +++ b/applications/email.nix @@ -118,23 +118,21 @@ with lib; let if address :matches ["From"] "postmaster@mimi.skynet.ie" { fileinto :create "''${1}.Spam_Report"; stop; + } + + # user+subdir + if address :matches ["To", "Cc"] "*+*@skynet.ie" { + fileinto :create "''${1}.''${2}"; + stop; + } + + # no detail, proceed normally + if header :is "X-Spam" "Yes" { + fileinto :create "''${1}.Junk"; + stop; } else { - # no detail, proceed normally - if address :detail ["To", "Cc"] "" { - if header :is "X-Spam" "Yes" { - fileinto :create "''${1}.Junk"; - stop; - } else { - fileinto :create "''${1}"; - stop; - } - } else { - # user+subdir - if address :matches ["To", "Cc"] "*+*@skynet.ie" { - fileinto :create "''${1}.''${2}"; - stop; - } - } + fileinto :create "''${1}"; + stop; } } }