you need to go for some ready made and Automatic solution, which is much more stable and very mature now.
iRedMail
A ZERO COST, fully fledged, full-featured mail server solution. All components are free and open source softwares.
An open source project, released under GPLv2, hosted on BitBucket (moved from Google Code).
What iRedMail does
Install and configure mail server related BINARY packages automatically from repositories which officially provided by Linux/BSD distributions.
Benefits
ZERO COST. All components are free and open source softwares.
Fully fledged and full-featured.
Easy, fast deployment in LESS THAN 1 MINUTE. View YouTube Video to check how easy it is.
Works on both non-virtualized and virtualized boxes, e.g. VMware, Xen, KVM, OpenVZ, VirtualBox, with i386 and x86_64 support.
Full-featured web admin panel - iRedAdmin-Pro. Online demo is available. You can setup mail server manually with the same softwares as used in iRedMail, but you cannot find a suitable web-based admin panel like iRedAdmin-Pro.
Works on major Linux/BSD distributions
Addition info
Used major open source softwares:
Postfix: SMTP service
Dovecot: POP3, IMAP, Managesieve service
Apache: Web server
MySQL: Storing application data and/or mail accounts
OpenLDAP: Storing mail accounts
Amavisd, SpamAssassin, ClamAV: Anti-spam, anti-virus
Roundcube: Webmail
Awstats: Apache and Postfix log analyzer
http://www.iredmail.org/