Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame^] | 1 | # global_sieve_after script |
| 2 | # global_sieve_before -> user sieve_before (mailcow UI) -> user sieve_after (mailcow UI) -> global_sieve_after |
| 3 | |
| 4 | require "fileinto"; |
| 5 | require "mailbox"; |
| 6 | require "variables"; |
| 7 | require "subaddress"; |
| 8 | require "envelope"; |
| 9 | require "duplicate"; |
| 10 | |
| 11 | if header :contains "X-Spam-Flag" "YES" { |
| 12 | fileinto "Junk"; |
| 13 | } |
| 14 | |
| 15 | if allof ( |
| 16 | envelope :detail :matches "to" "*", |
| 17 | header :contains "X-Moo-Tag" "YES" |
| 18 | ) { |
| 19 | set :lower :upperfirst "tag" "${1}"; |
| 20 | if mailboxexists "INBOX/${1}" { |
| 21 | fileinto "INBOX/${1}"; |
| 22 | } else { |
| 23 | fileinto :create "INBOX/${tag}"; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | if duplicate { |
| 28 | discard; |
| 29 | stop; |
| 30 | } |