I have a catchall mailbox so it receives *.mydomain.com
Im trying to achieve a dynamic sieve filter so that it creates if not existent a folder per alias and puts the mails inside the folder.
Some examples:
mailcow@mydomain.com -> Goes to my catchall@mydomain.com -> (goes into folder mailcow)
google@mydomain.com -> Goes to my catchall@mydomain.com -> (goes into folder google)
I have some problems with the filter
require [“fileinto”,“variables”,“envelope”,“mailbox”];
if envelope :matches “to” “*@mydomain.com” {
set “local” “${1}”;
fileinto :create “${local}”;
stop;
}
keep;
Just goes to folder catchall
require [“fileinto”, “variables”, “imap4flags”];
if header :matches “X-Original-To” “*@mydomain.com” {
set :lower “local” “${1}”;
fileinto :create “${local}”;
stop;
}
keep;
Just goes to inbox.