email creation

Hi hope someone is able to help me with this.

I am setting up a mail server using virtualmin and I am stuck creating e-mail users.

I am wanting to have the usernames like however what happens is that it creates a file in /var/spool/mail, but if you send mail to this address it creates a new file and will not show up in the users inbox.

I can see that in postfix/Virtual Domains it has set up maps to

It has also created 2 users & with the same id.

Thanks in advance

Rob King

See the FAQ:,frequently_asked_questions/#what_s_the_deal_with_in_mailbox_usernames

And then switch to Maildir format mail spools.

user@domain.tld mail just doesn’t work very well with mbox format spools…and there are no good reasons to use mbox format mailboxes anyway.

What’s wrong with mbox ? I think its just the opposite unless you can give me a good reason to stop pushing Maildir.

What's wrong with mbox ? I think its just the opposite unless you can give me a good reason to stop pushing Maildir.

Nothing, in particular, is wrong with mbox, it’s just a format that has lived beyond it’s utility. For very small mailboxes (under 1000 messages, maybe) mbox is probably more efficient…and works fine. But, for very large mailboxes (think ten to hundreds of thousands of messages), Maildir is dramatically faster, particularly on delete and move operations. And, Maildir works fine on those small mailboxes, too. So, you can maybe get a slightly faster mailbox with mbox for very small values of “mailbox”, but if you want to be able to handle larger spools, mbox just doesn’t handle it very well.

It is also, as mentioned, not possible (or at least not easy) to use user@domain.tld format usernames with Postfix and mbox format spools. Sendmail doesn’t have this particular issue, but mbox still has the performance issues on large mailboxes.

Try a few operations on mailboxes with 25,000 messages in both mbox and Maildir formats, and then you can let us know which one is a better choice for modern mail servers. Right now my inbox has 9811 messages (and it’s been known to get up to 36,000, though I’m trying to follow Inbox Zero principles these days, so I remove every email from Inbox as soon as I act on it…my queue of “not acted on” messages is a little long, I guess), my archived messages has over 20,000, and spam has 138,000 messages. And there are lots of other folders. mbox would make this volume of mail simply intolerably slow. I know, because up until a few years ago, I used mbox everywhere…the move to Maildir dramatically reduced the amount of time I spend waiting on moves, deletes, and opens. :wink:

Anyway, it’s nothing to argue about. If you like mbox, and you like Sendmail, and you don’t have mailboxes big enough to run into the limits of mbox, there’s not reason to stop using them.

So its the size of the box that makes the difference.

So how did you change from mbox to maildir? Isn’t maildir a postfix format? I don’t like postfix much and never really bothered with maildir because of that since I prefer sendmail.

So its the size of the box that makes the difference.

Primarily, yes. Though, historically, mbox files live in /var/spool/mail, which complicates backups and other administrative tasks…if you like to think of virtual servers as independent entities, anyway. Maildir historically lives in the users home directory, and so a tarball of /home/domain will get all mail. Virtualmin, of course, abstracts that problem away, and can backup email wherever it is. And, it is possible, though not common, to put mbox format files into the users home…and folders in an IMAP-capable system do end up in the users home.

So how did you change from mbox to maildir?

There are several tools out there. The best one is probably mb2md:

Requires the Perl TimeDate module, but otherwise is standalone and easy to use.

If you aren’t running into performance problems, sticking with mbox is fine.

Isn't maildir a postfix format?

Not at all. It was created by djb for qmail, but has since been adopted by most mail servers, because it has turned out to be a better format for a large majority of mail servers. Since most sendmail users are using procmail for mail delivery, and procmail has excellent Maildir support, you have easy access to Maildir. Postfix does have direct delivery support for Maildir (and mbox and a couple of other formats), but Virtualmin Professional, by default, does not use Postfix for delivery–it uses procmail, just like most Sendmail users use. I don’t think Sendmail handles delivery, at all, and always needs an MDA for any mailboxes format…so as far as Sendmail is concerned all mail spool formats are identical (but I might be misremembering…I just know I always used procmail for delivery when I did use sendmail in the past).

There is more info about mbox vs maildir here

It comes down to mbox using a single file to store the mail records so for low quantities of stored mail that file is small but with lots of stored email for a single account that single file can become quite large and cumbersome for the mail application to work with.



velvetpixel that link points to VM’s home page. :slight_smile:

Joe, so if I converted one user I have to do it for everyone ? And I assume that I need to shut down sendmail and dovecot for this too plus make the changes in WM/VM from mbox to maildir.

Joe, so if I converted one user I have to do it for everyone ?

It’s not mandatory, but you probably don’t want to go down the road of having different types of spools for different users…that way lies madness.

And I assume that I need to shut down sendmail and dovecot for this too plus make the changes in WM/VM from mbox to maildir.

Yes, you have to stop delivering new mail for a period of time. Dovecot can continue to run–since the mailbox isn’t changing during the process, it won’t matter. Once all boxes have been migrated, you change Dovecot to use the Maildirs, and restart it.

But, it does require a period of time where you aren’t delivering new mail, and the safest way to do that is to just stop your MTA (sendmail). After making the migration, you’d update the procmailrc, and start sendmail back up.

Though, as I mentioned, if you aren’t experiencing pain, mbox is fine. Dovecot probably has better caching and indexing than UW-IMAP, so it probably performs better with mbox than the benchmarks velvetpixel linked to.

That actually points out another issue with those benchmarks…they compare two completely different IMAP servers, as well as comparing the format of the mail spool…since we’re all using Dovecot for Maildir or mbox, it’d be hard to make those benchmarks mean much to us, since maybe Courier is just more efficient in some circumstances than UW-IMAP. But, in my experience Dovecot is notably faster when backed by a Maildir spool than an mbox spool, particularly when dealing with very large mail spools…and I’ve converted a lot of mailboxes over the years.

I think I’m going to have to do this at some point. I got a client that just loves leaving all his mail on the server and its GIGS in size now, 20 gigs to be exact. I don’t know if using maildir is even going to help.

Thank you for the information, I have now set up Maildir and seems to be working fine.


is that info still relevant and do the system needs to create 2 users when using the @ user format with Maildir?

It’s still relevant… but if you don’t look at the password file, you’ll never know :slight_smile:

It’s not about the Maildir format though, it’s that Postfix doesn’t support users with an @ sign in it’s name.

There’s some detail about that here in the section “What’s the deal with @ in mailbox usernames”:

I’m actually using the username.domain format but it’s kind of confusing for users tho. I preferably would try to avoid multiple user for the same user. Do we have the same problem with the % format? And if I want to switch from my current format to a new one, what are the steps to convert the existing ones?


The FAQ links to this brief post by the Postfix author that explains that some symbols (including @ and %) aren’t allowed in usernames used by Postfix:

There unfortunately isn’t a good way to convert from one format to the next… you’d either need to delete and re-create the user, or you could generate a Virtual Server backup, delete the Virtual Server, change the username format in Virtualmin, and then restore the backup.


Ok thanks. I thought there was a simpler way but at least we can do it :slight_smile: