mail from redhat linux

I have a Redhat linux machine..
I am using nagios and trying to send mail to my external account
But does not seem to be working..

1. i need to know how would i test if my linux machine can send mail to external accounts.
2.how do i test if nagios is sending mails to external account.
3. when mail are sent where are store before they are dispatched. in linux and in nagios
4. does nagios and linux have log file created.
BigflicksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fosiul01Commented:
1. i need to know how would i test if my linux machine can send mail to external accounts.

cat /etc/hosts | mail -s "test" urname@gmail.com

so it wil sent /etc/hosts file to your gmail account


2.how do i test if nagios is sending mails to external account.

 cat /var/log/maillog

check entery  , it will say something like this

Jun 29 13:10:41 mail sendmail[5209]: n5TCAfgm005209: from=nagios, size=306, class=0, nrcpts=1, msgid=<200906291210.n5TCAfgm005209@mail.websolution4u.co.uk>, relay=nagios@localhost
Jun 29 13:10:41 mail sendmail[5210]: n5TCAfA9005210: from=<nagios@mail.xxx.co.uk>, size=608, class=0, nrcpts=1, msgid=<200906291210.n5TCAfgm005209@mail.xxx.co.uk>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]

From nagios


3. when mail are sent where are store before they are dispatched. in linux and in nagios

as far i know, if mail it not queued, it does not store anywhere
but if its stored for queued
use mailq command to see

4. does nagios and linux have log file created.

yes:it should be in

/var/log/messages : nagios
/var/log/maillog for sendmail
0
BigflicksAuthor Commented:
i see 1193 in mailq.
 
n5OCScKL013374      226 Wed Jun 24 17:58 <nagios@localhost.localdomain>
                 (Deferred: Connection timed out with smtp.bigflix.com.)
                                         <pramod.shetty@bigflix.com>
n5OD7SlW015023      254 Wed Jun 24 18:37 <nagios@localhost.localdomain>
                 (Deferred: Connection timed out with smtp.bigflix.com.)
                                         <pramod.shetty@bigflix.com>
n5OCr8kT014449      255 Wed Jun 24 18:23 <nagios@localhost.localdomain>
                 (Deferred: Connection timed out with smtp.bigflix.com.)
                                         pramod.shetty@bigflix.com

 
where are i can ping my smtp server..
 
how do i clear the mailq.
0
fosiul01Commented:
smtp.bigflix.com , does not received any email

if you do

telnet smtp.bigflix.com 25

it would not connect, sthat mean smtp.bigflix.com does not acceptd any email

to clear mailq

/var/spool/mqueue

just empty this directory
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

BigflicksAuthor Commented:
telnet does work...
 

[root@nagios log]# telnet smtp.bigflix.com 25
Trying 10.65.168.41...
Connected to smtp.bigflix.com (10.65.x.x).
Escape character is '^]'.
220 smtp.bigflicks.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at  Mon, 29 Jun 2009 18:13:40 +0530
 
0
BigflicksAuthor Commented:
what is
n5OD7SlW015023      254 Wed Jun 24 18:37 <nagios@localhost.localdomain>
                (Deferred: Connection timed out with smtp.bigflix.com.)
                                        pramod.shetty@bigflix.com
nagios@localhost.localdomain - how can i change  - is that the hostname..
0
BigflicksAuthor Commented:
Do i have to set anything here in my linux server.
like what is the smtp server . where the mails should be going.
like MTA or sendmail or any client software and how do i do that
0
fosiul01Commented:
hi, allow me 1 hr, im away of my desk
0
Jan SpringerCommented:
This may be the problem:

nagios@localhost.localdomain

Forward and inverse DNS of your machine should match and sendmail should be sending emails with the correct host information.

Update forward and inverse dns (holler if you need help).



In /etc/mail/sendmail.mc:

MASQUERADE_DOMAIN(yourdomain.com)dnl


Save and exit, then:

make -C /etc/mail

and

service sendmail restart
0
fosiul01Commented:
ok  (Deferred: Connection timed out with smtp.bigflix.com.)

it  meants, sendmail unable to find host smtp.bigflix.com

now tel me someting

smtp.bigflix.com and nagaios server is this in Same network ??

because if i do telnet its showing like this

telnet smtp.bigflix.com 25
Trying 220.226.178.201...

its not showing 10.65.168.41
0
BigflicksAuthor Commented:
That what i was wondering why should it show me the public ip. though i have put the internal ip in the hosts file..
where does it pick the public ip because i rebooted the still it did not help.
The machine is in the same network
It can be possible it is reading from teh DNS
How do i disable the DNS for this mnachine..
0
BigflicksAuthor Commented:
i got the following message
[root@payment2 etc]# make -C /etc/mail
make: Entering directory `/etc/mail'
WARNING: 'sendmail.mc' is modified. Please install package sendmail-cf to update your configuration.
WARNING: 'submit.mc' is modified. Please install package sendmail-cf to update your configuration.
make: Leaving directory `/etc/mail'

is this correct.
0
fosiul01Commented:
good morning

ok so there must be a domain call smtp.bigflix.com .

so you saying, both mechine is in same network , and you can telnet to that mechine


you need to install sendmail-cf

yum install sendmail-cf

then run make command


1 question
since this is an internal mailserver

so, from nagios server, how are you definnign the username where the email will go ??

now if you try sent like this,

example


cat /etc/hosts | mail -s "test" urname@bigflix.com

it will try to deliver that email to bigflix.com which i said, it would not because bigflix.com is  a public domain and it cant received email

does it make sence?
0
BigflicksAuthor Commented:
i have modified the file

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user
        email                           pramod.shetty@bigflix.com       ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

how does the linux machine know which domain i need to send.. like smtp.bigflix.com- i can send to may be some other server.. mail.bigflix.com
so how i would define that..
 
0
BigflicksAuthor Commented:
[root@nagios objects]# rpm -qa "send*"
sendmail-8.13.1-3.RHEL4.5
is already installed
0
fosiul01Commented:
Please read carefully then reply .

1. to compile sendmail you need to install
yum install sendmail-cf

2. I just check pramod.shetty@bigflix.com does exists..  , its a public domain [ if that is your emamil address]

so after compille sendmail ,

after install sendmail-cf package

type

make   [ make sure you are in /etc/mail directory ]
then service sendmail restart

try to sent email from command line

cat /etc/hosts | mail -s "test" pramod.shetty@bigflix.com

show me the output of sendmail log



## how does the linux machine know which domain i need to send.. like smtp.bigflix.com- i can send to may be some other server.. mail.bigflix.com##

you can define any valid email adress, sent mail will sent to that address, [ its sendmail job to deliver]

suppose if you want to sent to user@yahoo.com

cat /etc/hosts | mail -s "test" user@yahoo.com  

sendmail will sent to yahoo  [ if you have static ip, reversedns, and your ip is not blocked as spam]

0
krishna_babu5Commented:
Is the issue resolved?
0
BigflicksAuthor Commented:
yes the issue has been resolved...
1. cofigure this server as smart host and forwareded the mails to the smtp server
2. if was picking the public ip refrencing the nsswitch.conf file..   where it was set to hosts and dns
removed dns and it started wotrking....
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BigflicksAuthor Commented:
done resolved
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.