Shashikant shah

Friday, 19 October 2012

POSTFIX SMTP RHEL - 5.5


Switch to Postfix from Sendmail

Yum install system-switch-mail
yum install postfix*
1.In the system-switch-mail window, 

  select Postfix and click Ok.

3.Go to this path:-

vim /etc/postfix/main.cf
69 myhostname = mail.example.com
77 mydomain = example.com
93 myorigin = $mydomain
107 inet_interfaces = all

155 mydestination = $myhostname, localhost.$mydomain, localhost
156 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
255 mynetworks = 192.168.0.0/24, 127.0.0.0/8
410 home_mailbox = Maildir/


NOTE:- In main.cf, lines starting with # are comments. Save the file after completing your
changes.

Make sure that all mail_spool_directory lines are commented out. Otherwise, it will override the setting in the home_mailbox line above.

# /etc/init.d/postfix restart

Test Postfix


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

[root@mail ~]# telnet mail.example.com smtp
Trying 127.0.0.1...
Connected to mail.example.com (192.168.0.123).
Escape character is '^]'.
220 mail.acme.local ESMTP Postfix
ehlo mail.example.com
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:shashi
250 2.1.0 Ok
rcpt to:shashi
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
test
.
250 2.0.0 Ok: queued as 9729067C17
quit
221 2.0.0 Bye
Connection closed by foreign host. 
 
[root@mail ~]#
 
To check if the mail indeed exists

[root@mail ~]# cd /home/shashi/Maildir/new
[root@mail new]# ls
1185669817.Vfd00I18012M795756.mail.example.com
[root@mail new]# cat 1185669817.Vfd00I18012M795756.mail.example.com
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 shashi@mail.acme.local  Thu Feb 22 21:48:28 2007
Return-Path: <shashi.example.com>
X-Original-To: shashi
Delivered-To: shashi@example.com
Received: from mail.example.com (mail.example.com [192.168.0.123])
        by mail.example.com (Postfix) with SMTP id 9729067C17
        for <shashi>; Thu, 22 Feb 2007 21:48:26 -0500 (EST)
Message-Id: <20070222134827.9729067C17@example.com>
Date: Thu, 22 Feb 2007 21:48:26 -0500 (EST)
From: shashi@example.com
To: undisclosed-recipients:;

test 
 
############### Complited SMTP #############################

No comments:

Post a Comment