Mail command confusion

When i run this command on my linux machine:

mail -s "CVS ALERT-CRITCAL" sandy@xyz.com

The system hangs up producing a dead letter. What should i do to resolve this.

I am using :

mailx -s "CVS ALERT-CRITCAL" sandy@xyz.com

This cammnd works fine on another Linux machine but says" mailxcommand not found " in the first machine

Can someone guide me here please

Thanks,
Sandeep

It waits for you to type in the mail body, and when you press ctrl-C to break out, it produces the dead.letter because you didn't finish the message.

mailx </dev/null if you don't want the message to have a body.

"command not found" typically means that the package which contains this command was not installed. Talk to the admin, or if the admin is you, talk to yourself.

can you please let me know what this dev/null means.....(</dev/null)....also can you send the complete code?

Thanks again
Sandeep

What is this doing in the "UNIX for Advanced & Expert Users" forum if you are unfamiliar with even the most basic features of the Unix shell??

mailx -s "I am a newbie" sandy@xyz.com </dev/null

era,

I am not new to unix but i am only new to this command. I have written lot of shell scripts but never used something like </dev/null in my previous scripts. Most of the time my isssues have been complicated and hence i go this forum. Mistakingly this time ,since this being new thing i just went ahead and asked this in this forum.Thanks for the help anyways.

regards,
Sandeep

Hi,

i used your command and it did not hang and it came to prompt
-----------------------------------------------------
mail -s "I am a newbie" sandy@xyz.com </dev/null
Null message body; hope that's ok
You have new mail in /var/spool/mail/root
-------------------------------------------------------

But i have not recieved any mail yet. when i checked in /var/spool/mail/root i found this in the root file:

From root@blr.xyz.com Tue Mar 18 23:40:00 2008
Return-Path: <root@blr.xyz.com >
Received: from root@blr.xyz.com (localhost.localdomain [127.0.0.1])
by root@blr.xyz.com
(8.12.8/8.12.8) with ESMTP id m2IIA0Jb007195
for <root@blr.xyz.com>; Tue, 18 Mar 2008 23:40:00 +0530
Received: (from root@localhost)
by root@blr.xyz.com (8.12.8/8.12.8/Submit) id m2IIA0xi007193
for root; Tue, 18 Mar 2008 23:40:00 +0530
Date: Tue, 18 Mar 2008 23:40:00 +0530
Message-Id: <200803181810.m2IIA0xi007193@root@blr.xyz.com >
From: root@blr.xyz.com (Cron Daemon)
To: root@blr.xyz.com
Subject: Cron <root@blr> /usr/lib/sa/sa1 1 1
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

Cannot open /var/log/sa/sa18: No such file or directory

please help

As far as I can tell you have a cron job /usr/lib/sa/sa1 1 1 which produced this output. It seems unrelated to your question.

thanks. can you guide me here, please don't get angry but your help is very much needed for me to go ahead to resolve this. what are possibe scenarios when a mail commad does not error out..... but the mail does nor reach recipient. Any config file i need to change?

Depends a lot on your set-up. Can you telnet localhost 25? Can you see the status of the mail spool (something like mailq)? Can you read mail server logs?

Mailq generated the mail that i sent during this period that did not reach sandeep@mysym.com

mailq
/var/spool/mqueue (3 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------

m2ID2oJb006079 1 Tue Mar 18 18:32 <root@blr.xyz.com>
(Deferred: Name server: blr.xyz.com: host name loo)
<sandeep@mysym.com>
m2IAB5Jb004895 1073 Tue Mar 18 15:41 <root@blr.xyz.com>
(Deferred: Name server: blr.xyz.com: host name loo)
<sandeep@mysym.com>
m2I9ZqJb004730 1073 Tue Mar 18 15:05 <root@blr.xyz.com>
(Deferred: Name server: blr.xyz.com: host name loo)
<sandeep@mysym.com>
Total requests: 3

Telnet results

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 blr.xyz.com ESMTP Sendmail 8.12.8/8.12.8; Wed, 19 Mar 2008 12:44:33 +0530

THis hangs and no results appear

Please review and let me know

Regards,
Sandeep

"Host name lookup failed" means that the host you are trying to send mail to does not exist. (You have to pass an option to mailq to see the full, untruncated error message.)

The mail is submitted, but Sendmail is sitting on it, because the mail routing is wrong.

Basically, when you send mail to the Internet, a DNS lookup against the receiving domain's "MX" record takes place. This instructs your MTA to contact a particular host which handles mail (Mail eXchanger) for this domain. This indirection exists so that large domains can centralize and manage their email infrastructure on one server, or a small set of servers; it also enables a fallback, because a domain's MX record can include one or more secondary entries in case the primary is down.

The MX for blr.xyz.com points to a host which does not exist, or blr.xyz.com simply does not exist in the DNS. Fix the DNS problem(s), and/or send the email to a domain which exists in reality, and has working email. (Try a sacrificial Hotmail or Gmail account if you just want to check that it works.) Or simply don't use a domain name, which will send the message to a local account (on most architectures I have seen; but some are set up to send even mail without a domain name to an upstream "smarthost").

... The log files reveal the real domain name you are using, which is not xyz.com, and it does indeed seems to have DNS issues.

vnix$ host -t ns mysym.com
Host mysym.com not found: 2(SERVFAIL)

I tried to look up the NS (name server) record for this domain, and got nothing. I cannot proceed.

If this is a domain name you use on your intranet, and you don't even mean to reach the "real" mysym.com, then your name server set-up is probably screwed; see if your /etc/resolv.conf is different than on other machines in your neighborhood.

For comparison, here's unix.com:

vnix$ host -t ns unix.com
unix.com name server ns2.sitelutions.com.
unix.com name server ns3.sitelutions.com.
unix.com name server ns4.sitelutions.com.
unix.com name server ns5.sitelutions.com.
unix.com name server ns1.sitelutions.com.

vnix$ host -t mx unix.com  # basically gets the answer from one of the NS hosts listed above
unix.com mail is handled by 10 ASPMX3.GOOGLEMAIL.com.
unix.com mail is handled by 10 ASPMX4.GOOGLEMAIL.com.
unix.com mail is handled by 10 ASPMX5.GOOGLEMAIL.com.
unix.com mail is handled by 1 ASPMX.L.GOOGLE.com.
unix.com mail is handled by 5 ALT1.ASPMX.L.GOOGLE.com.
unix.com mail is handled by 5 ALT2.ASPMX.L.GOOGLE.com.
unix.com mail is handled by 10 ASPMX2.GOOGLEMAIL.com.

This says that DNS for unix.com is handled by sitesolutions.com, and mail for unix.com is handled by ASMPX.L.GOOGLE.com -- the others are secondary fallback hosts in case the primary cannot be reached. This sort of set-up is atypical, although an increasing number of domains are moving to Googlemail for their email handling, so this might be becoming the norm actually. Anyway, this aside was just for educational purposes.

Sorry for the long delay; I was having the flu for a few days.

Hi era,

Sorry about being late in my reply. I was held up with some work and i could not reply you back.

First thing is that i did not provide you the correct domain name (mysym.com) in first case as i thought it would inappropriate for me to give for security reasons.Sorry about this. I ran the same as you said in you reply and got the below results( note that domain is dummy as i said i am not supposed to give this out).
------------------------------------------------------------------
$ host -t ns mysym.com

mysym.com name server xyz.domaincontrol.com.
mysym.com name server xyw.domaincontrol.com.

$ host -t mx mysym.com

mysym.com mail is handled by 10 xx3.mysym.com.
mysym.com mail is handled by 20 xx4.mysym.com.

$ cat /etc/resolv.conf

$ vi /etc/resolv.conf

domain mysym.com
nameserver 10.10.10.1

$ /etc/init.d/sendmail restart
Shutting down sendmail: [ OK ]
Shutting down sm-client: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]

[root@blr080cmgcv02 root]# sendmail -v sandy@mysym.com

WARNING: local host name is not qualified; fix $j in config file

----------------------------------------------------------------------
I followed the below document on the net :

Sendmail and SMTP AUTH on RedHat Linux 9 - Part 1 - Installing Sendmail

and did as specified in the doc , but i get the same error

WARNING: local host name is not qualified; fix $j in config file

Please help

Thanks,
Sandeep

I'm not really qualified to say if the Sendmail $j problem has any meaning here (my Sendmail book is at work, and I'm out of the office this week).

Can you connect to xx3.mysym.com and/or xx4.mysym.com? The error message basically means that these hosts did not resolve.

era,

No problem I can wait till you are back. I will check what you asked tmr .Thanks for all your help

Thanks,
Sandeep

Don't rely on me, look it up if it's important. They probably have it on sendmail.org. (Me, I switched to Postfix ages ago.)