1

I'm trying to setup dovecot + sieve plugin. I'm suing the Maildir format. I use Thunderbird to read the emails so i don't need a webmail on my server. The basic config works fine but now I want to add some rules in sieve to redirect some mails, like this one for example :

require ["envelope", "fileinto"];
if envelope :is "from" "test@mydomain.com" {
    fileinto "Test";
}

But sieve can't find the "Test" dir so it puts it into "Inbox". /var/log/syslog output :

dovecot: lda(test@mydomain.com): Error: sieve: msgid=<[...]>: failed to store into mailbox 'Test': Mailbox doesn't exist: Test
dovecot: lda(test@mydomain.com): sieve: msgid=<[...]>: stored mail into mailbox 'INBOX'

So I tried adding a mailbox manually (but ideally i would want it to be automatic when sieve request a new mailbox) by using this conf in dovecot :

 namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
    auto = subscribe
    special_use = \Junk
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox Test {
    auto = subscribe
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  prefix = 
}

Like that the mailbox is created upon reception of a mail and the mail is stored in ~/mail/Test/new/ but I can't find the folder/mailbox "Test" in Thunderbird. Every other mailbox appears correctly as a folder in Thunderbird but not the new one.

What am i doing wrong ? I can't find any example of dovecot config where people use custom mailboxes (only the few default ones). Is it even possible with dovecot ? Even better : is there a way to automate creation of mailbox when sieve need a new one ?

2

Use the :create parameter of the mailbox sieve capability (don't forget to require it!):

require ["envelope", "fileinto", "mailbox"];
if envelope :is "from" "test@mydomain.com" {
    fileinto :create "Test";
}
1

Ok what Jens Erat said was exactly what i was looking for. I forgot to require it when I tryied using the :create but now that works. The server creates new mailbox upon reception.

And for those wondering, what I also found is that in Thunderbird you have to right click your mailbox > Subscribe > Subscribe to new folders in order for it to check mails in the folders create on server side. It won't automatically subscribe to those (unless there is an option but I haven't seen it)

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.