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.

Old account
  • 467
  • 3
  • 5
  • 14

3 Answers3

9

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
  }
wedi
  • 318
  • 4
  • 11
  • I missed https://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 09:23
  • it may make sense to turn this into a wiki answer? going to mark yours as the correct answer for now – Old account 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
  }
}
kenlukas
  • 2,886
  • 2
  • 14
  • 25
Robin Thoni
  • 183
  • 1
  • 6
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

Philip Reynolds
  • 9,751
  • 1
  • 32
  • 33