Maildir + Dovecot = Not respecting the Inbox and folders in ~/Maildir option

When I check Dovecot IMAP/POP3 Server and I go into Mail Files, I see this as my setting: Mail file location = Inbox and folders in ~/Maildir But then after trying to send some emails, I look at my /home/domain/ directory and there’s both a /mail and a /maildir directory.

Why the disparity in the option selected compared to actual funcionality (this was the default selection when I installed virtualmin gpl via and how to fix?

Ubuntu 8.04

Well, that certainly seems unusual :slight_smile:

What email client were you using to send out those emails?

Also, what do you see if you look in ~/mail – do you see email being stored in there? And if so, are they sent messages, received message… or maybe something else?


Thanks for the quick reply Eric. I sent the emails by going Virtualmin > Login to Usermin and using the Compose Email there. I just tried this again by creating a new virtual server and trying it out. This is the error I get on the Mail Sent page right after I send my first email with a new virtual server: Failed to send mail : Failed to open IMAP mailbox : Mailbox doesn't exist: sent. The second time I send an email, I get the typical Mail Sent page, "Sending mail to .. .. done." My gmail account has received both of those emails.

I see this in /mail: (.imap is a directory, the others are files)

  • /.imap
  • drafts
  • inbox
  • sent

/.imap directory has this:

  • /drafts
  • /INBOX
  • /sent

Those 3 directories have the same contents with the same filesizes:

  • dovecot.index
  • dovecot.index.cache
  • dovecot.index.log

The actual sent file (the 2nd one apparently, since the first gave that error) seems to be found in /Maildir/.sent/cur.

I just tried something else. I sent an email from my gmail account to that account. I received this email in gmail:

This is the mail system at host

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

The mail system

<> (expanded from <>): User unknown
in virtual alias table

Final-Recipient: rfc822;
Original-Recipient: rfc822;
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Postfix; User unknown in virtual alias table

Well, let’s ignore the mail vs Maildir directories at the moment – it sounds like something else may be awry.

First, I’d make sure that the user you’re trying to send an email to exists on your server, and the email account is enabled.

If that’s the case, there may be a problem with your hostname – whenever you type “hostname” on the command line, the name that shows up should also be defined in /etc/hosts, and be listed in the “mydestination” line of /etc/postfix/


For the hostname I chose one of my domains as the hostname, was this an ok choice? I wanted something more generic but didn’t know what other option I had so I just went ahead and picked it. What would you have suggested for when virtualmin asks me for the hostname? So when I type hostname on the commandline, I get (I called this in the email example above).

Here’s my etc/hosts: localhost ubuntu

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

This is the literal contents of the mydestination part of /etc/postfix/

mydestination =, localhost

Well, I’d have thought that would work.

There’s some info regarding picking a fully qualified domain name (FQDN) here in the section labeled “Fully qualified domain name”:

In your case, for some reason, it doesn’t seem to think the user you’re sending an email to exists. Did you verify that email is enabled for that user, in Edit Mail and FTP Users?

Also, you may want to run System Settings -> Re-check config to see if it catches anything out of the ordinary.


Eric, the hostname idea was spot on - thanks a ton. I decided to wipe the partition, reintall Ubuntu 8.04, do, and this time chose as the hostname. So far email works well! I can send and receive using Usermin and then was able to setup Thunderbird, once I realized I needed to choose SSH in “Use secure connection”. I’m assuming SSH is preferred over TLS correct?

What’s odd though, is that I still have the home/domain/mail and home/domain/Maildir thing happening.

I see this in /mail: (.imap is a directory, the others are files)
* /.imap
* drafts
* inbox
* sent

/.imap directory has this:

* /drafts
* /sent

Those 3 directories have the same contents with the same filesizes:

* dovecot.index
* dovecot.index.cache
* dovecot.index.log</code></blockquote>

I checked Dovecot IMAP/POP3 Server > Mail Files and the radio button was already on “Inbox and folders in ~/Maildir” for “Mail file location”. Is this normal behavior to have ~/mail even though Dovecot isn’t using it?

Also, the home/domain/Maildir directory isn’t getting created when I do Create Virtual Server. I have to go into Usermin, send an email, it gives me the error Failed to send mail : Failed to open IMAP mailbox : Mailbox doesn’t exist: sent. Then it creates the Maildir folder.

I noticed something interesting. When I use thunderbird, the Maildir directory is created when I send or receive email. But if I send email with Usermin, it creates the /mail directory! This means that Usermin is actually the one creating the /mail directory instead of the correct /Maildir directory! I’ll stop using Usermin to send emails.

Is there any way to have the /Maildir directories automatically created when I Create a Virtual Server?

The Maildir directories are generally created automatically when sending or receiving an email, those shouldn’t cause trouble.

As far as Usermin and the “mail” directory goes – by default, it should play nice :slight_smile: I’m surprised to hear it’s the one creating the mail directory.

You may want to look in Webmin -> Webmin -> Usermin Configuration -> Usermin Module Configuration -> Read Mail, and verify that “Mail storage format for Inbox” is set to “Remote IMAP Server”.


It does have “Mail storage format for Inbox” set to “Remote IMAP Server” in Read Mail. But no worries, everything is working fantastic with me in Thunderbird! You’ve been a huge help Eric, I really thank you tons - thanks to you I’m successfully leaving cPanel behind and moving to Virtualmin : )

For future reference to others with this situation, here’s some key things I did. I wanted Sent/Trash/Drafts as a “sub-folder” of Inbox instead of them all being on the same level in Thunderbird, so that may have influenced some of these steps. Note that I’m using Ubuntu 8.04.

1.Make sure to install Virtualmin with script on a supported OS and use a fully qualified domain name!
2.Add this to etc/dovecot/dovecot.conf
namespace private {
prefix = INBOX.
inbox = yes

3.Open /etc/dovecot/dovecot.conf, find protocol imap, and make this change/add:
login_greeting_capability = yes
imap_client_workarounds = tb-extra-mailbox-sep

4.Uncheck Show only subscribed folders in Account Settings > Server Settings > Advanced in Thunderbird.
5.Also in that Advanced box, make sure you have “INBOX.” for Personal namespace and leave the other two (Public (shared) and Other Users) blank.
6.Take a look at your home/domain/Maildir directory. Any weird directories there? Delete them, Thunderbird will create them when you send your first email with that account, receive an email, save a draft, etc. If there’s a home/domain/mail directory and you’re using Maildir with the automated setup, delete that ~/mail directory if it bothers you.
7.After these changes, restart Thunderbird.

NOTE: I didn’t need to make the “Accessing from Outside” change of listen = *… not sure what it’s for but I didn’t need it for thunderbird : )