Solved

mail from redhat linux

Posted on 2009-06-29
18
1,017 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
ID: 24735601
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
ID: 24735639
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
ID: 24735661
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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:Bigflicks
ID: 24735673
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
ID: 24735684
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
ID: 24735710
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
ID: 24735830
hi, allow me 1 hr, im away of my desk
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 24736313
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
ID: 24736570
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
 

Author Comment

by:Bigflicks
ID: 24742396
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
ID: 24742417
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
ID: 24743082
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
ID: 24743635
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
ID: 24743650
[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
ID: 24743678
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
ID: 24770388
Is the issue resolved?
0
 

Accepted Solution

by:
Bigflicks earned 0 total points
ID: 24772309
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
ID: 24772321
done resolved
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mysql Crashing Intermittently 16 104
How do I make Autodiscover to co-exist in both an exchange 2010 and 2016 environments 5 78
Handling abuse of email address 7 35
awk file 6 54
Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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