8

The IMAP mailbox that Dovecot sets up has no SENT folder or TRASH folder. How do I set those up? Is there a way to place them outside of the INBOX hiearchy? I want to make sure that these folders work with the iPhone email client or any other mobile email client.

8

The original answer from 2011 is outdated.

Dovecot lifecycle announcement:

For any version before 2.2, we are not going to be providing any patches or fixes. This has been the case before, but we are now officially declaring them EOL.

I will still list all versions for reference. Sometimes admins have to run software they'd rather not run.

dovecot 1.x

Check the original answer.

dovecot 2.0.x

Use the autocreate plugin.

dovecot 2.1+

This is how you do it today. Add a namespace inbox {} section to define the folders. The example from the dovecot wiki is to demonstrate all possible features, I have adapted it to a real world example:

namespace inbox {
  inbox = yes
  separator = /

  mailbox "Drafts" {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox "Sent" {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Trash" {
    auto = subscribe
    special_use = \Trash
  }
  mailbox "Junk" {
    auto = subscribe
    special_use = \Junk
  }
  mailbox "Archive" {
    auto = subscribe
    special_use = \Archive
  }
}

If you want to be nice to your users with mail clients that create and stick to special use folders with funny (or translated) names, you can have dovecot reuse them instead of creating new ones. This will likely reduce support request from inexpierienced users who fall into dispair because of these folders being duplicated.
To do so, add more folder names to the setting above but do not set auto or use the default auto=no:

  mailbox "Gelöschte Elemente" {
    special_use = \Trash
  }
2
  • I missed serverfault.com/a/847509/409386 somehow 😲. It's a perfectly valid answer. I will still leave mine for the overview.
    – wedi
    Mar 27 '19 at 9:23
  • it may make sense to turn this into a wiki answer? going to mark yours as the correct answer for now Mar 27 '19 at 11:55
6

I got a similar problem, the Samsung Android app was creating its own TRASH folder, instead of using the existing Trash one. After fixing it, as described below, I had to remove then add again the account so it update its configuration.

The solution is the Dovecot namespace configuration:

See Dovecot Mailbox Settings

I personally use this (from here):

namespace inbox {
  type = private
  separator = .
  inbox = yes
  mailbox Drafts {
    special_use = \Drafts
    auto = subscribe
  }

  mailbox Junk {
    special_use = \Junk
    auto = create
  }

  mailbox spam {
    special_use = \Junk
    auto = no
  }

  mailbox Spam {
    special_use = \Junk
    auto = no
  }

  mailbox Trash {
    special_use = \Trash
    auto = subscribe
  }

  mailbox TRASH {
    special_use = \Trash
    auto = no
  }

  mailbox Sent {
    special_use = \Sent
    auto = subscribe
  }

  mailbox "Sent Mail" {
    special_use = \Sent
    auto = no
  }

  mailbox "Sent Messages" {
    special_use = \Sent
    auto = no
  }

  mailbox Archive {
    special_use = \Archive
    auto = create
  }

  mailbox "Archives" {
    special_use = \Archive
    auto = no
  }
}
3

So just to be aware, there's no "standard" here, different clients sometimes use different folders for Sent, Drafts, Trash etc.

Saying that, if you have a standard for your clients to use (or you're just using one client), you can auto-create and auto-subscribe clients to folders.

See the autocreate plugin

2
  • Also clients like Kmail or Thunderbird allow for changing the location folders to some custom ones Nov 17 '12 at 14:24
  • 2
    Note that the autocreate plugin has been deprecated in Dovecot 2.1. Now, you have to configure a mailbox with auto=create.
    – bortzmeyer
    Jan 20 '18 at 17:20

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.