Hello,

Thank you for your answer.

That's what I tried at first, but got error message from the editor (tb60+sieve)

Seems to be ok now.

Thanks for the help, I tried mailboxexists("xxx") instead of mailboxexists "xxx" which I did not find as such n the doc.

Cheers

On 2/28/19 11:37 AM, Martin Johannes Dauser via dovecot wrote:
What about extension "mailbox"?
https://wiki.dovecot.org/Pigeonhole/Sieve
https://tools.ietf.org/html/rfc5490#section-3

A simple example (not tested, but should work):

note: 
+ I use '/' instead of '.' as hierarchical separator
+ stop; stops the whole script, but you could use elsif instead.

require ["fileinto", "mailbox"];

if header :contains "header's name" "aaa" {
    if mailboxexists "INBOX/aaa" {
        fileinto "INBOX/aaa";
        stop;
    }
} 

if header :contains "header's name" "def" {
    if mailboxexists  "INBOX/def" {
        fileinto "INBOX/def";
        stop;
    }
}

Greetings Martin




On Thu, 2019-02-28 at 10:42 +0100, AvV via dovecot wrote:
Dear All,

Thanks ofr the great job so far.

I have crawled the doc & web, and did not find oh to check for the 
presence of a folder ina  a mailbox?

I know about "fileinto :create" of course, but the purpose is
slightly 
different: I want to automate the move into a folder based on some
rules 
but *only if* an associated folder is present (which name is based
on 
the rule), otherwise I will do a form of catch-all.

Example:

- INBOX
      +- abc
      +- def

- Rule detects "aaa" in someheader field: folder "aaa" not present"
-> 
continue;

- Rule detect "def" in some header field: "def exists" -> fileinto
"def" 
    ; stop;

Any help appreciated.

Cheers,

A/