# Which IMAP Server?

## Vitaliy

I would like to setup an IMAP server but I am not sure which one to go with. Is there a specific one that is considered to be the standard (ie: Apache of the mail servers)?

----------

## tcunha

I really like dovecot - not just an IMAP server but also IMAPS/POP3/POP3S - since it's very easy to setup.

HTH.

----------

## baeksu

I've had good experience with courier-imap. It was the easiest to set up in Debian, so I used it even after I moved my server to Gentoo.

----------

## kashani

I'll give the negative answer. Use anything other than uw-imap and you'll be pretty happy. The main problem with uw-imap is that it does not support maildir format, the Gentoo default, for storing mail and they go to great lengths to point out why this is a good thing. In short it's maintained by idiots. 

kashani

----------

## Vitaliy

 *kashani wrote:*   

> I'll give the negative answer. Use anything other than uw-imap and you'll be pretty happy. The main problem with uw-imap is that it does not support maildir format, the Gentoo default, for storing mail and they go to great lengths to point out why this is a good thing. In short it's maintained by idiots. 
> 
> kashani

 From my understanding Gentoo does not have a default, unless you are referring to package maintainers preference. Isn't mbox the traditional UNIX way?

----------

## kashani

mbox was pretty much the only format until maildir was created in '97 or so by the author of qmail. The nice thing about maildir is that you can deal with each mail message as an individual file which is nice for busy mail servers as you do not have to lock a user's mail spool which is the case in mbox. mbox is a single file containing all the emails. The same also applies when reading mail because you're going to write to the spool when you mark a mail as read. Additionally your MTA will block while your POP/IMAP daemon has the lock and vice versa. Basically mbox is a concurrency nightmare on a busy system. Additionally it's near impossible to run with any stability with NFS because now you have multiple servers locking the spool away from other servers along with nfslocks. 

I worked at an ISP from '96-'99 that sadly did all the above.

The problem with maildir is that file systems generally do not enjoy having thousands of 8k files on them. At the next ISP I worked at 7 million mail accounts created a directory structure that took up 400GB. Not the data itself, just the data describing the dirs and files. However running a mail system this size would have been impossible with mbox. Additionally when I first arrived we used less gear to run 250k mailboxes with maildir than my previous ISP used to run 25k. 

In regards to Gentoo defaults, each profile has USE flags associated with it. maildir is the default in most of them. If it was set per individual package Postfix might deliver to mbox while Mutt tried to read maildir and so on. 

Do a emerge --info and you should see maildir as one of your default USE flags. You could add -maildir mbox to your /etc/make.conf if you wanted to overide that. 

kashani

* fixed explanation of mbox.

----------

## Vitaliy

 *kashani wrote:*   

> mbox was pretty much the only format until maildir was created in '97 or so by the author of qmail. The nice thing about maildir is that you can deal with each mail message as an individual file which is nice for busy mail servers as you do not have to lock a user's mail spool which is the case in mbox. because mbox. The same also applies when reading mail because you're going to write to the spool when you mark a mail as read. Additionally your MTA will block while your POP/IMAP daemon has the lock and vice versa. Basically mbox is a concurrency nightmare on a busy system. Additionally it's near impossible to run with any stability with NFS because now you have multiple servers locking the spool away from other servers along with nfslocks. 
> 
> I worked at an ISP from '96-'99 that sadly did all the above.
> 
> The problem with maildir is that file systems generally do not enjoy having thousands of 8k files on them. At the next ISP I worked at 7 million mail accounts created a directory structure that took up 400GB. Not the data itself, just the data describing the dirs and files. However running a mail system this size would have been impossible with mbox. Additionally when I first arrived we used less gear to run 250k mailboxes with maildir than my previous ISP used to run 25k. 
> ...

 Great, thank you very much for your detailed input, I really appreciate that. Compiling dovecot as I am typing this.

----------

## karnesky

 *kashani wrote:*   

> I'll give the negative answer. Use anything other than uw-imap and you'll be pretty happy.

 I use uw-imap on gentoo & I'm happy. *Quote:*   

> The main problem with uw-imap is that it does not support maildir format, the Gentoo default,

 Gentoo is about choice (isn't it)? There have been patches to uw-imap to add maildir support & it supports a plethora of other formats, including UW's mix (which I use & which seems fairly good).  AFAIK, the only popular IMAP servers that can use maildir are dovecot and courier.  UW and many others complain about courier's lack of adherence to the IMAP specs.  Cyrus & other popular IMAP servers also don't support maildir. *Quote:*   

> In short it's maintained by idiots.

 This is ironic--Mark Crispin is one of the primary maintainers.  He invented IMAP and is the primary author of most of the IMAP RFCs.

Yes, he has a beef with the maildir format & some object to what they see as a personal ax grinding.  But he is hardly an idiot about IMAP.  UW-IMAP is the closest thing to a reference implementation there is.

----------

## kashani

I could pick on Cyrus or DBmail as well, but they fail to pique my ire as much as uw-imap.

1. Reference platform.

Yes it is, client lib bugs and all. Whether it adheres to the standard in a meaningful way is something many have questioned. I'm not qualified to say who is right, probably both sides.

2. unsupported 3rd party patches for maildir.

I've already kicked out qmail for not having needed functionality available in the main code tree so I'm not about to start that nonsense again. Also Gentoo doesn't have the patches as a choice.

3. mbox, the default, does not support concurrent access.

4. mbx supports concurrency, but requires the use of c-client which limits your choice in the number of things that can write to your mail spool/dir where ever it is.  Additionally it too is not NFS safe. 

5. mix is basically mbx with some status files. Still has concurrency issues which means NFS issues. 

Gentoo has always given you enough rope to hang yourself and will continue to do so which is one of the reasons I like it. However just because you can implement a system with inherent bottlenecks doesn't mean I should recommend them. 

On the other hand using iSCSI in place of NFS might make a number of these issues go away. Something to think about. 

kashani

----------

## karnesky

 *kashani wrote:*   

> I could pick on Cyrus or DBmail as well, but they fail to pique my ire as much as uw-imap.

 I have no experience with DBMail, but I'd be interested in your critique of Cyrus.  My two favorite IMAP servers are Cyrus and Dovecot (assuming someone else is doing install/config/maintenance).  The reason I use UW-IMAP on my personal server is because it is so trivial to install & configure (and I don't need to worry about NFS issues you raised).  They also picked it for use at my work, but I don't know implementation details. *Quote:*   

> Yes it is, client lib bugs and all.

 And which bugs would those be? *Quote:*   

> 4. mbx supports concurrency, but requires the use of c-client which limits your choice in the number of things that can write to your mail spool/dir where ever it is.

 I was under the impression that c-client wasn't used by, for example, exim (which can write to mbx just fine).  I could be wrong, though.  UW-IMAP, like Dovecot an Cyrus, is able to retrieve messages stored in a spool that you specify & then store them in some other format. *Quote:*   

> 5. mix is basically mbx with some status files. Still has concurrency issues which means NFS issues.

 I don't know about this.  mix seems closest to Dovecot's dbox format.  Like dbox and maildir, mail is put in multiple files.  By default, I think it splits on 1MB (rather than per message like maildir).  Locking is obviously better than mbox/mbx (which store the whole spool in a single file).  I'm sure there are still problems & maildir might be better.  But maildir isn't perfect in this regard either--Dovecot's maildir support has locking, which is non-standard.  They describe other quirks on their wiki too.

One thing your description of maildir left out is that maildir and imap were not developed with the other in mind.  Multiple prominent IMAP developers have since spoke of issues with using the two together.  These issues are why dbox and mix were created in the first place.  I don't know if either has enough features to make maildir fans happy.  But I do know they make IMAP fans happier than traditional alternatives (mbox/maildir).  Since I'm in this latter camp, I hope that some IMAP-aware mailbox format catches on.

----------

