Saturday 6 August 2016

Setup Basic POP3/IMAP Mail Server in Centos

1.First Step is to install postfix. // Its MTA

yum install postfix
The main configuration file is located at /etc/postfix/ Edit the file and make sure you change the following lines with your domain name.
mydomain =
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, $mydomain

2.yum install cyrus-sasl //Denying Relay

To enable SASL authentication open /etc/postfix/ and add the following lines
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

3. Install Dovcot // POP3/IMAP Server

Open the dovecot config file /etc/dovecot.conf and make the following changes. You may need to comment or uncomment certain lines
protocols = imap imaps pop3 pop3s
Look for the line auth default and make these changes. Be careful with the lines as they are heavily commented out.
auth default {
mechanisms = plain login
passdb pam {
userdb passwd {
socket listen {

client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix

4. Install Squirrelmail //Webbased email for handy

yum install squirrelmail
To setup the squirrelmail under apache, open /etc/httpd/conf/httpd.conf and insert the following lines
Alias /squirrelmail /usr/local/squirrelmail/www
<Directory /usr/local/squirrelmail/www>
Options Indexes
AllowOverride none
DirectoryIndex index.php
Order allow,deny
allow from all

The squirrelmail configuration utility is located in /usr/share/squirrelmail/config/
Run the configuration utility and set the server settings to SMTP and change your domain name to

 5.Start Services

/etc/init.d/postfix start
/etc/init.d/dovecot start
/etc/init.d/saslauthd start
service httpd restart

  5.Create Local users

Just create a localuser with adduser
adduser rahul
and update the password of rahul using
passwd rahul

6. Squirrelmail is available at

 You are Done.... For any queries, drop a comment.