Search This Blog

Wednesday, March 16, 2011

Configure mail Client (Internal Mail Server)

Today i was configuring mail for one of our Linux server .

After following the normal steps for configuring the mail client i wasn't able to send mail .

following were the steps taken for configuring the mail client.

Make sure you have following rpms installed.
# rpm -qa| grep sendmail
sendmail-cf-8.13.8-2.el5
sendmail-8.13.8-2.el5

(Note:Most linux distributions comes with sendmail rpm but most of the time you need to install sendmail-cf rpm according to your distribution).

Modified below parameter from /etc/mail/sendmail.mc file.

dnl define(`SMART_HOST', `internalmail.XXX.com')dnl

Here you define the name of your internal mail server.
(Note : Make sure you can ping the mail server from client machine).

Now its time to compile the /etc/mail/sendmail.mc file to /etc/mail/sendmail.cf.
the command used is.
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

After compiling its time to send the mail.

mail -s "test" myemailid@XXX.com , relay=root@localhost
Mar 16 10:58:13 XXX sendmail[5220]: p2G5SCCf005220: from=, size=389, class=0, nrcpts=1, msgid=<201103160528.p2g5scga005219@xxx.xxx.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Mar 16 10:58:13 XXX sendmail[5219]: p2G5SCgA005219: to=XXX@XXX.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30073, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p2G5SCCf005220 Message accepted for delivery)
Mar 16 10:58:15 XXX sendmail[5222]: STARTTLS=client, relay=XXX.XXX.com., version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Mar 16 10:58:16 XXX sendmail[5222]: p2G5SCCf005220: to=, ctladdr= (0/0), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=120389, relay=XXX.XXX.com. [XXXX], dsn=5.1.8, stat=User unknown
Mar 16 10:58:17 XXX sendmail[5222]: p2G5SCCf005220: p2G5SHCf005222: DSN: User unknown
Mar 16 10:58:17 XXX sendmail[5222]: p2G5SHCf005222: to=, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31656, dsn=2.0.0, stat=Sent

It was bit clear from the log that machine was sending the email to itself but not able to send it to internal mail server.

Later i checked that the machine wasn't registered in DNS.so it was not returning its ip address after i issue following command.
host HOSTNAME.XXX.com
when i added the machine in dns it was successfully resolving the ip address.
host HOSTNAME.XXX.com
HOSTNAME.XXX.com has address XX.XXX.XXX.XXX

So it was all due to DNS not having our server entry and nothing wrong with Configuration of mail.


No comments:

Post a Comment