summaryrefslogtreecommitdiffstats
path: root/modules/mail/files/patch/learn.sieve
blob: eb952ad220528b8113e1abf0ac968d643c26ea16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require ["vnd.dovecot.execute", "vnd.dovecot.debug", "imap4flags", "imapsieve", "environment", "variables"];

if environment :matches "imap.mailbox" "*" {
    set "mailbox" "${1}";
    debug_log "running for mailbox ${mailbox}";
}

if string "${mailbox}" "Junk" {
    debug_log "categorizing as spam";
    setflag "\\seen";
    execute :pipe "spam";
}
else {
    if string "${mailbox}" "Trash" {
        debug_log "categorizing as trash";
        stop;
    }

    debug_log "categorizing as ham";
    execute :pipe "ham";
}

debug_log "done";