During my BSc, I developed a modern and distributed electronic mail software with a number of features as my thesis project. The key components of the service were an SMTP server, MIME extensions, load-balancing using an internal DNS server, and a fully-fledged web interface for mail composition. The project was written in C# and ASP.NET with MSSQL database support.
Licence: Note that the code can be changed and reused as long as you keep the copyright inside and at the beginning of source files in the source directory unchanged. If this service is used everywhere, it should be cited as Alireza Poshtkohi, PMail: A distributed email service, https://github.com/poshtkohi/pmail.