Friday 10 August 2012

Sendmail



By default sendmail server allows to connect to local host only. So we should edit the /etc/mail/sendmail.mc file to allow connect to other hosts.
Ver: 8.14
Port: 25
Log file: /var/log/maillog
The sendmail daemon is configured from a directory of files in /etc/mail.
 There are two basic configuration files:
  • sendmail.cf The main sendmail configuration file.
  • sendmail.mc A macro that's easier to edit, which can be used to generate a new sendmail.cf file
1.              sendmail and m4 rpm are required to configure sendmail
server#Rpm –ivh sendmail-8.14.4-8.el6.x86_64.rpm
server#Rpm –ivh sendmail-cf-8.14.4-8.el6.noarch
server#Rpm –ivh m4-1.4.13-5.el6.x86_64.rpm
2.    Mail server program reads the /etc/mail/sendmail.cf. To change the configuration on mail server, we should edit the /etc/mail/sendmail.mc file. 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. In exam you should generate it with m4 command

server #nano /etc/mail/sendmail.mc

Comment the below line(line no 116)(default its without comment). This is useful for it can allow other computers to use your sendmail server by commenting out this line.

dnl #DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

save and close.

3.    Now generate new sendmail.cf file by using m4 command as shown here

server #m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

4.    Now restart sendmail service and also set it on with chkconfig
server #chkconfig sendmail on
server #service sendmail restart
Configure sendmail client side

1.   Check sendmail and m4 rpm for install. Open /etc/mail/sendmail.mc file and locate line no 116 and put a dnl with # sing and save file. All step are same which you have done on server.


2.   Now restart sendmail service and also set it on with chkconfig
server #chkconfig sendmail on
server #service sendmail restart

3.   Pgrep sendmail
Testing of sendmail server
1.   We will test sendmail server by sending and receiving mail in lab environment. for this we use two user one on each system.

Server#useradd test1
Server#passwd test1
Client#useradd test2
Client#passwd test2

2.   Now send mail from user vinita to nikita and from nikita to user vinita and also check each others mail by mail command

Server#mail test2@client

No comments:

Post a Comment