Solved

mail from redhat linux

Posted on 2009-06-29
18
1,011 Views
Last Modified: 2013-12-18
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.
0
Comment
Question by:Bigflicks
18 Comments
 
LVL 29

Expert Comment

by:fosiul01
Comment Utility
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
 

Author Comment

by:Bigflicks
Comment Utility
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
 
LVL 29

Expert Comment

by:fosiul01
Comment Utility
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
 

Author Comment

by:Bigflicks
Comment Utility
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
 

Author Comment

by:Bigflicks
Comment Utility
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
 

Author Comment

by:Bigflicks
Comment Utility
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
 
LVL 29

Expert Comment

by:fosiul01
Comment Utility
hi, allow me 1 hr, im away of my desk
0
 
LVL 28

Expert Comment

by:Jan Springer
Comment Utility
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
 
LVL 29

Expert Comment

by:fosiul01
Comment Utility
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
Why do Marketing keep bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

 

Author Comment

by:Bigflicks
Comment Utility
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
 

Author Comment

by:Bigflicks
Comment Utility
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
 
LVL 29

Expert Comment

by:fosiul01
Comment Utility
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
 

Author Comment

by:Bigflicks
Comment Utility
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
 

Author Comment

by:Bigflicks
Comment Utility
[root@nagios objects]# rpm -qa "send*"
sendmail-8.13.1-3.RHEL4.5
is already installed
0
 
LVL 29

Assisted Solution

by:fosiul01
fosiul01 earned 500 total points
Comment Utility
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
 
LVL 1

Expert Comment

by:krishna_babu5
Comment Utility
Is the issue resolved?
0
 

Accepted Solution

by:
Bigflicks earned 0 total points
Comment Utility
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
 

Author Comment

by:Bigflicks
Comment Utility
done resolved
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now