Problem with mailx - Can execute but email not received

Hi,

I tried running mailx command like this:

sadm@bioinfo-z:~$ mailx foobar@gmail.com
Subject: testgmail
Some content.
.
EOT

As you can see although it is successfuly executed.
But still I can't receive email at my foobar@gmail.com
account.

What is the cause?

check the return status $?

it could be in your send queue and yet to be delivered.

If you are on solaris, you could check the status of the delivery in /var/adm/messages

Im pretty sure its a dns issue (again) and if you type mailq, i bet all the mail you sent is in deferred state ...
If so, fix the dns issue if your box is using a dns or just take it out on /etc/nsswitch.conf (remove dns on the hosts entry) and you would want to check also if your mail gateway is set correctly in mail.cf (DS macro on sendmail system)

A default Solaris syslog.conf configuration will log mail.debug (and above) to /var/log/syslog - not /var/adm/messages. Only mail.crit (and above) will be logged to /var/adm/messages.

Cheers
ZB

try checking the mail queue.

'mailq' and see if the email left the system.

someone already recommended checking the mailq. my bad. but here is an example output.

servername:/root# mailq
/var/spool/mqueue is empty
Total requests: 0

-Sowser

After executing the mailx, I tried "mailq" it gives me this:

sadm@bioinfo-z:~$ mailq
Mail queue is empty

How can I fix this issue?

After running the mailx, looking at syslog shows this:

root@bioinfo-z:/# tail -f var/log/syslog
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/pickup[21761]: [ID 197553 mail.info] 6C8B8BA1E: uid=30 from=<sadm>
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/cleanup[21847]: [ID 197553 mail.info] 6C8B8BA1E: message-id=<20070411025353.6C8B8BA1E@bioinfo-z.comp.nus.edu.sg>
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/qmgr[20137]: [ID 197553 mail.info] 6C8B8BA1E: from=<sadm@bioinfo-z.comp.nus.edu.sg>, size=337, nrcpt=1 (queue active)
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/smtp[21849]: [ID 197553 mail.info] 6C8B8BA1E: to=<ewijaya@gmail.com>, relay=post.comp.nus.edu.sg[137.132.80.42]:25, delay=0.2, delays=0.1/0.04/0.01/0.05, dsn=5.7.1, status=bounced (host post.comp.nus.edu.sg[137.132.80.42] said: 554 5.7.1 <ewijaya@gmail.com>: Relay access denied (in reply to RCPT TO command))
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/cleanup[21847]: [ID 197553 mail.info] 916CCBA20: message-id=<20070411025353.916CCBA20@bioinfo-z.comp.nus.edu.sg>
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/bounce[21850]: [ID 197553 mail.info] 6C8B8BA1E: sender non-delivery notification: 916CCBA20
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/qmgr[20137]: [ID 197553 mail.info] 916CCBA20: from=<>, size=2298, nrcpt=1 (queue active)
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/qmgr[20137]: [ID 197553 mail.info] 6C8B8BA1E: removed
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/error[21851]: [ID 197553 mail.info] 916CCBA20: to=<sadm@bioinfo-z.comp.nus.edu.sg>, relay=none, delay=0.05, delays=0.01/0.04/0/0, dsn=5.0.0, status=bounced (local delivery is disabled)
Apr 11 10:53:53 bioinfo-z.comp.nus.edu.sg postfix/qmgr[20137]: [ID 197553 mail.info] 916CCBA20: removed

How can I solve the problem?

Are you sure that local delivery should be disabled, and "relay=none" ? Double check those settings at your mail server config.
Also, grep -r for "916CCBA20" - this is the message ID containing the reason for the "bounceback" (at least according to your logs)

How do you do that? Sorry I'm new to Unix/Solaris 10.

There's a useful article for relay function for sendmail, take a look here.
Ahh, this is postfix.... ok, the same applies, but you may want to see those pages to get more clarity on what's happening.
Also, there are many threads in this forum discussing mail troubleshooting, use the search function.