On cPanel servers emails are stored in one of two formats: Maildir or Mdbox. Both have their advantages and disadvantages. As a quick summary, the main feature of Mdbox is that it uses less space. However, Maildir is easier to work with. For instance, with Maildir it is much easier to restore emails.
There are different ways to check what format an account uses. One way is to check the folder structure, which we will look at shortly. You can also check the contents of the mail/mailbox_format.cpanel file in your home folder:
$ cat ~example/mail/mailbox_format.cpanel ; echo maildir
The Maildir format uses “flat files”. Each email is stored as a separate file in the relevant directory. This format makes a lot of sense: it makes it easy to move, backup and restore emails. You can also use tools such as
du to list the size of one or more folders and use utilities such as
grep to quickly locate emails that match certain criteria.
The one downside of Maildir is that it uses lots of inodes / blocks. Each email is a file, and each file uses at least one block. The more emails a user has, the more space is wasted.
The directory structure of a mailbox that uses Maildir looks as follows:
$ ls -A1F ~example/mail/ cur/ .Drafts/ .Junk/ example.com/ new/ .Sent/ tmp/ .Trash/
Almost all the directories shown above are used by the default mailbox. The cur and new directories store read and unread emails in the inbox, respectively. The other directories are the usual mail folders (Drafts, Sent, Spam and Trash).
Each mailbox has its own folder in the directory named after the domain (here example.com). The directories contain the same folders as shown above (cur, new etc.). It is a very logical structure. Each mailbox has its own directory, and inside the directory are subdirectories for each folder. And, each email is simply a file in the relevant directory.
The Mdbox format stores multiple emails in a single file. Its main selling point is that it uses less inodes. Mdbox has disadvantages as well. The following two are particularly painful:
The directory structure is also quite different. As with Maildir, user mailboxes are stored in a directory named after the domain, and there is a separate directory for each mailbox. However, the actual emails – for any mail folder – live in the ~/mail/storage directory. For instance, all emails for email@example.com are stored in ~example/mail/example.com/info/storage. All the storage files have the name m and a sequential number as the extension.
We can convert your mailboxes from one format to another. This is generally easy to do, but there is one thing to be aware of. If you convert a mailbox from Mdbox to Maildir and you use POP3 rather than IMAP then all emails in your inbox are duplicated.
As always, please contact us if you would like us to convert the mailbox format on your account.