diff --git a/data/conf/dovecot/sieve_after b/data/conf/dovecot/sieve_after index d668a94c..0b43dbcf 100644 --- a/data/conf/dovecot/sieve_after +++ b/data/conf/dovecot/sieve_after @@ -7,6 +7,18 @@ require "envelope"; if header :contains "X-Spam-Flag" "YES" { fileinto "Junk"; } -if allof (envelope :detail :matches "to" "*", header :contains "X-Moo-Tag" "YES") { - fileinto :create "INBOX/${1}"; + +if allof ( + envelope :detail :matches "to" "*", + header :contains "X-Moo-Tag" "YES", + mailboxexists "INBOX/${s}" + ) { + fileinto "INBOX/${s}"; +} +elsif allof ( + envelope :detail :matches "to" "*", + header :contains "X-Moo-Tag" "YES" + ) { + set :lower "s" "${1}"; + fileinto :create "INBOX/${s}"; }