Installing and setting up Postfix SMTP Server in RHEL 4 or CentOS 4 is easy. Postfix has secure default settings so we just need to open it up a bit.
Install Postfix and Mail Transport Agent Switcher

1. If you did not add postfix and system-switch-mail-gnome during the CentOS installation, you can add it now. Postfix is located in the package Mail Server while system-switch-mail-gnome is in X Windows System. Learn how to add or remove applications here.Switch to Postfix from Sendmail
By default, Sendmail is the active SMTP server. Here’s how to change it.

1. Click Applications, select Preferences, select More Preferences and click Mail Transport Agent Switcher. This will launch the system-switch-mail window.Configure Postfix

3. Double click on the file main.cf to open it for editing. We need to make it listen to network request, accept mails bound to our domain and use maildir which is a better mailbox format than mbox the default.inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain home_mailbox = Maildir/
Make sure that all mail_spool_directory lines are commented out. Otherwise, it will override the setting in the home_mailbox line above.

4. Restart the postfix service. Learn how to restart services here.Test Postfix

1. Click Applications, select System Tools, and click Terminal. This will launch the Terminal window.Sample postfix session. Replace johndoe with any valid user account. The dot after the line test is a command that should be typed in.
If you need to add new user accounts, learn how to add or remove user accounts here.
[root@mail ~]# telnet localhost smtp Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 mail.acme.local ESMTP Postfix ehlo host 250-mail.acme.local 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250 8BITMIME mail from: johndoe 250 Ok rcpt to: johndoe 250 Ok data 354 End data with <CR><LF>.<CR><LF> test . 250 Ok: queued as 9729067C17 quit 221 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 1185669817.Vfd00I18012M795756.mail.acme.local [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 [127.0.0.1])
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:;
test
[root@mail mail]#
If you encounter any problems, check the log file at /var/log/maillog.
Review your Postfix aliases configuration file. There are some predefined email aliases that might conflict with your existing mail accounts like sales, marketing, info, etc.
By default Postfix does not require authentication to send emails. This means any Tom, Dick and Harry that have access to your network can use your SMTP server to send spam emails. Learn how to enable SMTP Authentication (SMTP AUTH) in Postfix here.***
Posted on 3/12/2007 and last updated on 7/12/2008
Filed under CentOS 4 , Postfix , Red Hat Enterprise Linux 4
Share This




November 8th, 2007 at 7:19 am
Very nice and useful as well as easy to understand guidance manual from the auther. Please provide NFS configuration also in similer way. As NSF configuration is typically hard for newbies like us and we require GUI and Text based metarial for setup and configuration of that also.
P.S. Drop email when ever you are providing this as early as possible.
Regards,
vibhu Dwivedi
November 13th, 2007 at 11:57 pm
Hi there.
Yeah as Vibhu dwivedi says, great tuorial but would have been better done through a GUI for newbies lik me :p. I know how ya fell Vibhu dwivedi im very very very very new to all this with linux and mail servers and CentOS etc… (try 2 days)
Btw i couldnt get the cd /home/johndoe/Maildir/new command to work. When i did it it just said that the directory cd does not exist……
Im running CentOS 4.4 if thats any help?
Hope you can get back to me with the e-mail i submitted
Thanks tho