Wednesday, April 1, 2015

sendmail server configuration in linux step by step.


SMTP

Simple Mail Transfer Protocol

Electronic mail service is mechanism to exchanging mails between users on the internet. 

E mail is one of the most popular services on the internet. It follows client/server architecture by the combination of different protocols and Email Programs.


SMTP: It is popular Mail-Transport-Agent protocol in TCP/IP.

It is responsible to sends and receives the mail between server and clients 

It works on 25 port number.


POP3: It is a Mail User Agent, to compose and download the mails.

It does not maintain any backup of mails in server. It works on 110 port.


IMAP:  It is one of a Mail User Agent, to compose and download the mails.

It maintains backup copy of mails in server side. So users can access their mails anywhere. It works on 143 porn.


M4: Macro Compiler- usually reads input file and copy it to the output file.


Packages :   sendmail
sendmail-cf
sendmail-devel
m4 

Script         : /etc/mail/sendmail.mc
/etc/mail/sendmail.cf

Services : sendmail

Port number     : Smtp – 25
Pop3 – 110
Imap - 143

Daemon : sendmail



There are different Mail Programs are available: 

Send Mail:  Send mail is the most popular UNIX-based implementation of the Simple Mail Transfer Protocol (SMTP) for transmitting e-mail.
  
Postfix:  Postfix is an open-source mail transfer agent (MTA) that routes and delivers electronic mail.
It is easier-to-administer, fast and secure alternative to the widely-used Send mail MTA.

Qmail :  Qmail is an Internet Mail Transfer Agent (MTA). 
It more secure replacement for the popular Send mail program

It uses the Simple Mail Transfer Protocol (SMTP) to exchange messages with MTA's on other systems.

Configuration of MAIL Server 

Mail server name is mail.zoom.com whose IP is 192.168.0.20 
Step 1: CHECK IP & HOST ENTRIES 
[root@client ~]#ifconfig 
[root@client ~]# netconfig 
[root@client ~]# service network restart 
[root@client ~]# ping 192.168.0.0 -b 
[root@client ~]# vi /etc/sysconfig/network 
NETWORKING=yes 
HOSTNAME=mail.zoom.com 

:wq! 
[root@client ~]# vi /etc/hosts 

127.0.0.1 localhost.localdomain   localhost
192.168.0.20 mail.zoom.com mail
:wq! 
[root@client ~]# hostname mail.zoom.com
 [root@client ~]# hostname 
mail.zoom.com 

* NOW LOG OFF & LOG IN *
Step 2 : CHECK & INSTALL THE PACKAGES 

[root@mail ~]# rpm -qa | egrep -i "sendmail|m4" 
or 
[root@mail ~]# yum list installed | egrep -i "sendmail|m4" 
[root@mail ~]# yum remove sendmail*  m4* -y 
[root@mail ~]#  rm -r /etc/mail*

Now Install the packages

[root@mail ~]# yum  install sendmail*  m4* -y
Step 3) Edit Main Configuration File 
[root@mail ~]# vi /etc/mail/sendmail.mc 

116 dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl 155 LOCAL_DOMAIN(`mail.zoom.com')dnl 
:wq! 
Step 4) Compile the file 
[root@mail ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf 
Step 5 ) Start the service 
[root@mail ~]# service sendmail restart 
Step 6 ) Create users & test the mail at command prompt by mail client utility. 
[root@mail ~]# useradd tom 
[root@mail ~]# useradd joy 
[root@mail ~]# passwd tom 
[root@mail ~]# passwd joy 
Switch to a user tom and sendmail a mail to joy 
[root@mail ~]# su - tom 
[tom@mail ~]$ mail  joy@mail.zoom.com 
Subject: test mail from tom 
he hello 
test mail from tom mail test 1 
## New row first column type dot (.) To end the
message
Cc: tom@mail.zoom.com
[tom@mail ~]$
[tom@mail ~]$ exit

Switch to a user joy & check the mails 

[root@mail ~]# su - joy 

[joy@mail ~]$ 
Type mail and see the output as below [joy@mail ~]$ mail 
Mail version 8.1 6/6/93.  Type ? for help. "/var/spool/mail/joy": 1 message 1 new 
>N 1 tom@mail.zoom.com Sat Jul 12 04:54 19/601   "test mail from
tom" 
& 1 
Message 1: 
From tom@mail.zoom.com  Sat Jul 12 04:54:18 2008 
Date: Sat, 12 Jul 2008 04:51:38 -0400 
From: tom@mail.zoom.com 
To: joy@mail.zoom.com 
Subject: test mail from tom 
Cc: tom@mail.zoom.com 
he hello 
test mail from tom mail test 1 
& x 
You have mail in /var/spool/mail/joy 

[joy@mail ~]$ exit 













No comments:

Post a Comment