Postfix SMTP Server Setup Howto for RHEL/CentOS 6
INSTALL POSTFIX AND DOVECOT
[root@ttc ~]# yum install -y postfix dovecotEdit the file /etc/postfix/main.cf and uncommend the lines below.
inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain home_mailbox = Maildir/
In mydestination make the comment in other two lines
If Your are using ipv4 set ipv4 like in ipv6 also for both set all
inet_protocols = ipv4
Make sure that all mail_spool_directory lines are commented out.
Otherwise, it will override the setting in the home_mailbox line above.
Start the Service
# chkconfig postfix on # service postfix restart # service postfix status
Add a user like nan
Type in the command newaliases in a terminal window.
This will rebuild the aliases database file.
# newaliases
In the Terminal window, type in the highlighted commands below
[root@ttc ~]# telnet localhost smtp Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 ttc.hpserver.com ESMTP Postfix ehlo localhost 250-ttc.hpserver.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN mail from:<nan> 250 2.1.0 Ok rcpt to:<nan> 250 2.1.5 Ok data 354 End data with <CR><LF>.<CR><LF> Hi Nan This is test mail Created on 22/12/2011 . 250 2.0.0 Ok: queued as DB7C213F6AC quit 221 2.0.0 Bye Connection closed by foreign host. [root@ttc ~]#To check if the mail indeed exists
[root@ttc ~]# cat /home/nan/Maildir/new/1324552225.V808I9f698M53702.ttc.hpserver.com
Return-Path: <nan@ttc.hpserver.com>X-Original-To: nan
Delivered-To: nan@ttc.hpserver.com
Received: from localhost (localhost.localdomain [127.0.0.1])
by ttc.hpserver.com (Postfix) with ESMTP id DB7C213F6AC
for <nan>; Thu, 22 Dec 2011 16:39:18 +0530 (IST)
Message-Id: <20111222110948.DB7C213F6AC@ttc.hpserver.com>
Date: Thu, 22 Dec 2011 16:39:18 +0530 (IST)
From: nan@ttc.hpserver.com
To: undisclosed-recipients:;
Hi Nan This is test mail
Created on 22/12/2011
[root@ttc ~]#
Dovecot POP3/IMAP Server Setup
Configure Dovecot
The settings for Dovecot are spread out across several files. Edit the files listed below and uncomment and updates its lines accordingly./etc/dovecot/dovecot.conf
protocols = pop3 imap lmtp/etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir/etc/dovecot/conf.d/20-pop3.conf
pop3_uidl_format = %08Xu%08Xv pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
[root@ttc ~]# service dovecot restart
Stopping Dovecot Imap: [FAILED]
Starting Dovecot Imap: [ OK ]
[root@ttc ~]# chkconfig dovecot on
In the Terminal window, type in the highlighted commands below.
[root@ttc ~]# telnet localhost pop3
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.
user nan
+OK
pass nan
+OK Logged in.
list
+OK 2 messages:
1 471
2 479
.
retr 1
+OK 471 octets
Return-Path: <nan@ttc.hpserver.com>
X-Original-To: nan
Delivered-To: nan@ttc.hpserver.com
Received: from localhost (localhost.localdomain [127.0.0.1])
by ttc.hpserver.com (Postfix) with ESMTP id CF3D313F6AC
for <nan>; Thu, 22 Dec 2011 16:12:14 +0530 (IST)
Message-Id: <20111222104228.CF3D313F6AC@ttc.hpserver.com>
Date: Thu, 22 Dec 2011 16:12:14 +0530 (IST)
From: nan@ttc.hpserver.com
To: undisclosed-recipients:;
HI This is test mail to you on 22/12/2011
.
retr 2
+OK 479 octets
Return-Path: <nan@ttc.hpserver.com>
X-Original-To: nan
Delivered-To: nan@ttc.hpserver.com
Received: from localhost (localhost.localdomain [127.0.0.1])
by ttc.hpserver.com (Postfix) with ESMTP id DB7C213F6AC
for <nan>; Thu, 22 Dec 2011 16:39:18 +0530 (IST)
Message-Id: <20111222110948.DB7C213F6AC@ttc.hpserver.com>
Date: Thu, 22 Dec 2011 16:39:18 +0530 (IST)
From: nan@ttc.hpserver.com
To: undisclosed-recipients:;
Hi Nan This is test mail
Created on 22/12/2011
.
quit