Postfix mail server configuration in Centos 6.2

In this post I configure Postfix mail server, Dovecot, and Squirrel mail. Postfix is a mail server, Which is an alternate to send mail. Postfix act as Mail Transfer Agent [MTA]. Dovecot is open source IMAP POP3 server, It act as Mail Delivery Agent [MDA]. The Squirrel mail provide the web based mail application.

I will explain some of the important term used in mail server configuration.

1. MTA —-> Mail Transfer Agent, send and received email between the MTA. Some MTA severs are: Postfix,Sendmail

2. MDA —-> Mail Delivery Agent, Received mail from MTA for delivery to mailbox. Some MDA are: Dovecot,Procmail

3. MUA —-> Mail User Agent, email client, It can be user web browser or Thunderbird, .

Your DNS should have MX record entry for your mail server.
Firewall and selinux should be disabled.
# service iptables stop
# vim /etc/selinux/config # line number 7 edit this file to disable the selinux
Reboot your server
# init 6

If your centos server already has sendmail server remove it
# yum remove sendmail

My test scenario to configure the mail server

Hostname =mailon
IP address =

I have MX record entry for my mail server in my DNS server.


# yum install postfix -y

Open the file in any text editor, I prefer vim
# vim /etc/postfix/

myhostname = ## edit the hostname line# 75
mydomain = ## edit the domain name line# 85
myorigin = $myhostname ## comment out the line# 99
inet_interfaces = all ## change to all line# 119
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain ## include $mydomain at the end line# 166
mynetwork =, ## include your network ip line# 268
home_mailbox = Maildir/ ## comment out line 424 to enable inbox directory

Start the Postfix service

# service postfix start
# chkconfig postfix on ## to start the service on startup

Testing Postfix

[root@servername ~]# telnet localhost 25
Trying ::1…
Connected to local host
Escape character is ‘^]’.
220 ESMTP Postfix

ehlo localhost
250-SIZE 10240000
250 DSN

mail from: mailuser
mail from: mailuser
rcpt to: mailuser
250 2.1.5 Ok
354 End data with .
hello amit this the gnu-linux

250 2.0.0 Ok: queued as 4C8F91E00F5
221 2.0.0 Bye
Connection closed by foreign host.

Check the mail in user Maildir

[root@mailon ~]# cd /home/mailuser/Maildir/new
[root@mailon new]# vim 1373093244.Vfd03I20023M85510.mailon
X-Original-To: mailuser
Received: from localhost (localhost [IPv6:::1])
by (Postfix) with ESMTP id 4C8F91E00F5
for ; Sat, 6 Jul 2013 12:15:24 +0530 (IST)
Date: Sat, 6 Jul 2013 12:15:24 +0530 (IST)
To: undisclosed-recipients:;
hello amit this the gnu-linux

If you got the mail it means postfix is working now.

Issues–> if you do not get the mail. Check the log detail in /var/log/maillog, If you you find the permission denied error. Check the the permission on Maildir in user home, make it writeable or if it is not there create the directory.