mailx for red hat version 5.4

Hi,

i am trying to use mailx utility on red hat. I am unsuccessful in doing it. kindly see below for the steps i am doing :-

1) mailx -s "testing" user@ipaddress
2) when i check my /var/mail/ folder 
there is no file being generated by the name user, instead there is a file being generated by the name of aap.
3) as per me, my syntax is correct. but i am unable to find why the file is not being generated by the name of user 

Did you give mail body correctly?
As below:

mailx -s "testing" user@ipaddress < mail_body

where mail_body is the file having the mail content.
OR type your above command, hit enter, then type some message, then to stop, Crtl+D.

i have tried the way recommended by you. but the problem still persists. I am unable to use mailx. any other suggestions.

the file with the username is still not being created after incorporating the above suggestion.

Assuming that there is only one computer involved here, shouldn't this be:

mailx -s "testing" user <mail_body

It is well worth testing that local mail is working.

Even if the the mail is destined for another computer we would expect the syntax:

mailx -s "testing" user@domain < mail_body

I'm having the same issue even after trying with the suggested method. It is creating the filename with os user in the source system instead of receipient user in /usr/mail folder and I'm not getting mail at user@domain address.

Just curious do you have mail server running ... can you check with telnet

$ telnet <IP ADDRESS> 25 

if this works try sending email from the telnet .. directly ... see what error you get ... or check your /var/log/mail<logs>

if everything works on telnet ... try to check with pine or mutt emailers ..

mailx and mail utility are simple way to send email ...

If you have root access on machine check any bounce mails etc ...

The mail file on the source system should be in text format and readable with say "cat" or of course with "mailx". Is the content or the file the mail you sent, or a bounce?
Any clues in your mail log?

I've got the following in my /var/log/maillog

Jan 11 12:56:41 hostname sendmail[20855]: p0B5SNNm023940: to=<user@hostname.doamin>, ctladdr=<user@localhost.localdomain> (502/501), delay=06:28:18, xdelay=00:00:00, mailer=esmtp, pri=750423, relay=hostname.domainname., dsn=4.0.0, stat=Deferred: Name server: hostname.domainname.: host name lookup failure

Is this a new installation which does not work, or is the problem confined to certain email addresses?

Assuming that your sendmail has been configured to allow external mail and is basically working, certain ISPs will attempt a reverse DNS lookup of your server and ignore you if the lookup fails. You may need a "DM" record for a valid external domain in /etc/mail/sendmail.cf for example.

What is in /etc/resolv.conf ?
Does "nslookup" (or "dig") work for external addresses?

Does "mailq" command show items still queued ?

It is a new Installation.

[COLOR=black]

/etc/resolv.conf
----------------------
#nameserver <ip_address>
#nameserver <ip_address>
#nameserver <ip_address>
#nameserver <ip_address>
nameserver <mymail_ipaddress>
options attempts:5
options timeout:15
 
 
$ nslookup <mymail_ip_address>
;; connection timed out; no servers could be reached
 
$ dig <mymail_ip_address>
 
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> <mymail_ip_address>
;; global options:  printcmd
;; connection timed out; no servers could be reached

It would appear that whatever is at <mymail_ipaddress> is not a nameserver. It can't even look it's own name up. In fact, what is it and where is it?
I assume that the "<" and ">" character are not in the record and that the line looks roughly like this:

nameserver 10.10.10.10

What is in this file:

/etc/mail/service.switch

Let's get some more context.
Is this one computer of many on a corporate network or say a single home computer? You can often read the settings values from another working computer or if it is a single home computer get the settings from advice on your ISP's website.