Ars Technica had an article about running your own mailserver, to include IMAP, awhile back (http://arstechnica.com/information-technology/2014/02/how-to... while it's targeted at the individual user, a lot of the steps would apply to a larger, multi-server organisation. You could extend postfix with a PostgreSQL database, split the different servers onto different hosts &c.
Honestly, these days it's probably easier and cheaper to just buy Google Apps or Office365, but if you want to control your own destiny it's really not difficult.
The HN "detect URLs and make them clickable links" code was confused by your punctuation, resulting in garbage at the end of the URL. Here it is cleaned up:
Honestly, these days it's probably easier and cheaper to just buy Google Apps or Office365, but if you want to control your own destiny it's really not difficult.