TransWikia.com

How do I setup a SENT and TRASH folder with Dovecot?

Server Fault Asked by Old account on November 22, 2021

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.

3 Answers

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
  }

Answered by wedi on November 22, 2021

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
  }
}

Answered by Robin Thoni on November 22, 2021

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

Answered by Philip Reynolds on November 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP