How do I setup a SENT and TRASH folder with Dovecot?
Solution 1:
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
}
}
Solution 2:
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
}
Solution 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