Postfix and Dovecot is one of the good combination for email server. Postfix is a free and open-source mail transfer agent (MTA) that routes and delivers electronic mail, intended as an alternative to the widely used Sendmail MTA. Dovecot is an open source IMAP and POP3 email server for Linux/UNIX-like systems, written with security primarily in mind. Dovecot is an excellent choice for both small and large installations. It's fast, simple to set up, requires no special administration and it uses very little memory.
This is simple command to completely uninstall Postfix and Dovecot installation from your Ubuntu:
$ sudo apt-get purge postfix
$ sudo apt-get purge dovecot-common
$ sudo apt-get purge dovecot-imapd
$ sudo apt-get purge dovecot-pop3d
$ sudo apt-get purge dovecot-core
Note: the command work only if you install them using default package command for Ubuntu, e.g. using ‘apt-get install’ or using ‘dpkg -i *.deb’. FOr installation by self compile package, please refer to HOWTO that usually delivered with the source code package.