0

I'm running a catch-all email setup with my own domain (mydomain.tld). My hoster offers me to create arbitrary Sieve mail filter rules. I would like to create a rule that moves all incoming mail to a folder that equals the alias of the recipient (under my domain), even if the alias is unknown before.

In practice: If I receive an email via <alias>@mydomain.tld, I want a Sieve rule that automatically creates a folder named alias (if non existing) and moves the email into that folder.

A) Is this possible with Sieve?

B) Could you provide the necessary Sieve rule?

0

It is that easy using the Sieve variables extension, which matches the regex * to a useable variable:

require ["fileinto", "variables", "mailbox"];
if header :matches "Delivered-To" "*@mydomain.tld" {
    fileinto :create "${1}";
}

EDIT: it is better to use "Delivered-To" (the envelope) than "To"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.