Rename Junk folder in dovecot IMAP server

Being English, I find the terms "Trash" and "Junk" confusing because they mean essentially the same thing. I want to rename these folders on my Dovecot IMAP server to "Deleted" and "Spam" respectively because those terms mean more to me.

So I changed 15-mailboxes.conf like this, instead of defining mailbox Junk:

mailbox Spam {
  special_use = \Junk
  auto = subscribe
}

and similarly for Trash to Deleted.

I'm assuming \Junk is a magic word and should not be changed. I also changed my sieve scripts to redirect mail to the new directory names. I also renamed the existing folders in the filesystem, Junk to Spam etc.

When I restart Dovecot and connect an IMAP client (Outlook 2013 in this case) Dovecot still creates the old named folders as well as the new ones. So we have "Junk" as well as "Spam". "Junk" is newly created and empty.

How do I suppress this behaviour? I just want "Spam" and "Deleted" on their own.

Here the namespace of inbox

namespace inbox {

  #mailbox name {
    # auto=create will automatically create this mailbox.
    # auto=subscribe will both create and subscribe to the mailbox.
    #auto = no

    # Space separated list of IMAP SPECIAL-USE attributes as specified by
    # RFC 6154: \All \Archive \Drafts \Flagged \Junk \Sent \Trash
    #special_use =
  #}

  # These mailboxes are widely used and could perhaps be created automatically:
  mailbox Drafts {
    special_use = \Drafts
    auto = subscribe
  }
  mailbox Spam {
    special_use = \Junk
    auto = subscribe
  }
  mailbox Deleted {
    special_use = \Trash
    auto = subscribe
  }

  # For \Sent mailboxes there are two widely used names. We'll mark both of
  # them as \Sent. User typically deletes one of them if duplicates are created.
  mailbox Sent {
    special_use = \Sent
    auto = subscribe
  }

  # If you have a virtual "All messages" mailbox:
  #mailbox virtual/All {
  #  special_use = \All
  #}

  # If you have a virtual "Flagged" mailbox:
  #mailbox virtual/Flagged {
  #  special_use = \Flagged
  #}
}

Solution 1:

It is not Dovecot recreating the Trash folder; it is your mail client (Outlook in this case).

Some mail clients, when first setting up the definition, will probe the mail server to identify folders with the special use flags such as \Junk, and will then use these flagged folders for the special purpose. Others, such as Outlook, will just go ahead and do things their own way, and will create a folder with the name that they want to use regardless.

What you can do, is to use the mailbox_alias plugin to make both names valid. See here for an example, which makes both "Sent" and "Sent Items" equivalent: https://wiki2.dovecot.org/Plugins/MailboxAlias