Installing and setting up Postfix SMTP Server in Red Hat Enterprise Linux 6 or CentOS 6 is easy. Postfix has secure default settings so we just need to open it up a bit.

Configure Postfix

Edit main.cf1. Edit the file /etc/postfix/ and update the lines below.
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/

In, lines starting with # are comments. Save the file after completing your changes.

NoteMake sure that all mail_spool_directory lines are commented out. Otherwise, it will override the setting in the home_mailbox line above.
Service Configuration2. Restart the postfix service. Learn how to restart services here.

Test Postfix

Terminal1. Click Applications, select System Tools, and click Terminal. This will launch the Terminal window.
Terminal2. In the Terminal window, type in the highlighted commands below.

Sample postfix session. Replace johndoe with any valid user account. The dot after the line test is a command that should be typed in.

NoteIf you need to add new user accounts, learn how to add or remove user accounts here.
[root@mail ~]# telnet localhost smtp
Connected to localhost.localdomain (
Escape character is '^]'.
220 mail.acme.local ESMTP Postfix
ehlo localhost
250-SIZE 10240000
250 DSN
mail from:<johndoe>
250 2.1.0 Ok
rcpt to:<johndoe>
250 2.1.5 Ok
354 End data with <CR><LF>.<CR><LF>
250 2.0.0 Ok: queued as 9729067C17
221 2.0.0 Bye
Connection closed by foreign host.
[root@mail ~]#


To check if the mail indeed exists

[root@mail ~]# cd /home/johndoe/Maildir/new
[root@mail new]# ls
[root@mail new]# cat 1185669817.Vfd00I18012M795756.mail.acme.local

Don’t worry, you don’t have to type in the whole filename above. Just type in the first few characters say 118 then press Tab to activate automatic completion.

From johndoe@mail.acme.local  Thu Feb 22 21:48:28 2007
Return-Path: <johndoe@mail.acme.local>
X-Original-To: johndoe
Delivered-To: johndoe@mail.acme.local
Received: from localhost.localdomain (localhost.localdomain [])
        by mail.acme.local (Postfix) with SMTP id 9729067C17
        for <johndoe>; Thu, 22 Feb 2007 21:48:26 -0500 (EST)
Message-Id: <20070222134827.9729067C17@mail.acme.local>
Date: Thu, 22 Feb 2007 21:48:26 -0500 (EST)
From: johndoe@mail.acme.local
To: undisclosed-recipients:;


[root@mail mail]#
NoteIf you encounter any problems, check the log file at /var/log/maillog.
NoteReview your Postfix aliases configuration file. There are some predefined email aliases that might conflict with your existing mail accounts like sales, marketing, info, etc.

Visit the forum to ask for help or to give a comment.

Posted on 7/21/2011 and last updated on 7/22/2011
Filed under CentOS 6 , Postfix , Red Hat Enterprise Linux 6