Send mail Configuration on linux

Send mail Configuration on linux
We are going to Send mail Configuration on linux

•A linux server with ip address 192.168.1.1 and hostname Server
•A linux client with ip address 192.168.1.2 and hostname Client1
•A Configured DNS server on Linux server
•Updated /etc/hosts file on both linux system
•Running portmap and xinetd services
•Firewall should be off on server

Configure the DNS server before start configuration of sendmail server.

Required RPM:

1.Sendmail
2.M4

#yum install sendmail
#yum install m4

Mail server program reads the /etc/mail/sendmail.cf. When Sendmail is started or restarted with the service sendmail restart command a new sendmail.cf file is automatically generated if sendmail.mc has been modified.

open /etc/mail/sendmail.mc for editing
#vi /etc/mail/sendmail.mc
show hidden line with : set nu option on vi command mode
By default, the following line limits sendmail access to connect local host only [line no 116]
You can allow other computers to use your sendmail server by commenting out this line.

DAEMON_OPTION(‘Port=smtp, Addr=127.0.0.1, Name=MTA’)dnl 

comment this line with dnl keyword followed by # sign

dnl # DAEMON_OPTION(‘Port=smtp, Addr=127.0.0.1, Name=MTA’)dnl
save this file with :wq and exit.
Now generate new sendmail.cf file by using m4 command as shown here
#m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Now restart sendmail service and also set it on with chkconfig
#chkconfig sendmail on
#service sendmail restart
if sendmail service restart without any error means you have configured sendmail successfully.

Configure sendmail client side

Required RPM:

1.Sendmail
2.M4
Now generate new sendmail.cf file by using m4 command as shown here
#m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Now restart sendmail service and also set it on with chkconfig
#chkconfig sendmail on
#service sendmail restart

Testing of sendmail server

We will test sendmail server by sending and receiving mail in lab environment. for this we use two user one on each system.
Now create one user on each system abu on server
#useradd abu
#passwd abu
and Thagir on client system
#useradd thagir
#passwd thagir
Now send mail from user abu to thagir and from thagir to user abu and also check each other’s mail by mail command
Use full user name to send mail. For example to send mail to nikita use [email protected]
#mail [email protected]
Subjest: test mail
This is test mail
Press Ctrl+C
Now check on user abu mail box.

Leave a Reply

Your email address will not be published. Required fields are marked *