?
Solved

mailx command working but not mail

Posted on 2005-05-04
11
Medium Priority
?
3,146 Views
Last Modified: 2013-12-27
I have configured sendmail on my Solaris server and the following works fine

mailx -s "Hello World" david@ghg.org.uk < message.txt

but the following does not work i.e I do not receive the message

cat message.txt | mail david@ghg.org.uk

If I look in the log file it says that the mail has been accepted by my smtp
host but I never receive it

Any ideas?.
0
Comment
Question by:daveyu
  • 3
  • 2
  • 2
  • +3
11 Comments
 
LVL 9

Expert Comment

by:kfullarton
ID: 13927188
Try this...

cat message.txt > mail david@ghg.org.uk
0
 
LVL 40

Expert Comment

by:jlevie
ID: 13929179
What does the log file show for that transaction?
0
 
LVL 48

Expert Comment

by:Tintin
ID: 13931447
kfullarton.

I assume you made some typos with your suggestion.  Not much point in copying message.txt to mail and getting a syntax error.

daveyu.

Run mail and mailx with the -v flag.  This gives you verbose output and may help you see where it is failing.

BTW, what happens if you do

mail david@ghg.org.uk <message.txt

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:neteducation
ID: 13931504
The command

cat message.txt | mail david@ghg.org.uk

should work if your sendmail.cf is correct.

If you have an internal mailserver then it might be the easiest to define this as a smarthost. Go to your sendmail.cf (in /etc or in /etc/mail) and edit the line that starts in DS to point to your mailhost, i.e. like this:

DSmail.mydomain.com
0
 

Author Comment

by:daveyu
ID: 13934382
I tried mail -v, it gives Illegal option error.

I have our external mail server set as a "smart host" in sendmail.cf

I tried mail david.urquhart@ghg.org.uk < message.txt, I did not receive the email
but the log file looks okay (to me), here it is:

14060 >>> 220 ghg_ads.domain1.ghg.org.uk ESMTP Sendmail 8.13.4/8.13.4; Thu, 5 May 2005 12:11:21 +0100 (BST)
14060 <<< EHLO ghg_ads.domain1.ghg.org.uk
14060 >>> 250-ghg_ads.domain1.ghg.org.uk Hello localhost [127.0.0.1], pleased to meet you
14060 >>> 250-ENHANCEDSTATUSCODES
14060 >>> 250-PIPELINING
14060 >>> 250-EXPN
14060 >>> 250-VERB
14060 >>> 250-8BITMIME
14060 >>> 250-SIZE
14060 >>> 250-DSN
14060 >>> 250-ETRN
14060 >>> 250-DELIVERBY
14060 >>> 250 HELP
14060 <<< MAIL From:<root@ghg_ads.domain1.ghg.org.uk> SIZE=105
14060 >>> 250 2.1.0 <root@ghg_ads.domain1.ghg.org.uk>... Sender ok
14060 <<< RCPT To:<david.urquhart@ghg.org.uk>
14060 >>> 250 2.1.5 <david.urquhart@ghg.org.uk>... Recipient ok
14060 <<< DATA
14060 >>> 354 Enter mail, end with "." on a line by itself
14060 <<< Received: (from root@localhost)
14060 <<<       by ghg_ads.domain1.ghg.org.uk (8.13.4/8.13.4/Submit) id j45BBLax014059
14060 <<<       for david.urquhart@ghg.org.uk; Thu, 5 May 2005 12:11:21 +0100 (BST)
14060 <<< Date: Thu, 5 May 2005 12:11:21 +0100 (BST)
14060 <<< From: Super-User <root@ghg_ads.domain1.ghg.org.uk>
14060 <<< Message-Id: <200505051111.j45BBLax014059@ghg_ads.domain1.ghg.org.uk>
14060 <<< Content-Type: text
14060 <<< 
14060 <<< Hello From ghg_adds via mail
14060 <<< 
14060 <<< .
14060 >>> 250 2.0.0 j45BBLOw014060 Message accepted for delivery
14060 <<< QUIT
14060 >>> 221 2.0.0 ghg_ads.domain1.ghg.org.uk closing connection
14062 === CONNECT netserver2.domain1.ghg.org.uk
14062 <<< 220 netserver2.domain1.ghg.org.uk SMTP; Thu, 05 May 2005 12:05:46 +0100
14062 >>> EHLO ghg_ads.domain1.ghg.org.uk
14062 <<< 250 netserver2.domain1.ghg.org.uk Hello
14062 >>> MAIL From:<root@ghg_ads.domain1.ghg.org.uk>
14062 <<< 250 <root@ghg_ads.domain1.ghg.org.uk>... Sender ok
14062 >>> RCPT To:<david.urquhart@ghg.org.uk>
14062 <<< 250 <david.urquhart@ghg.org.uk>... Recipient ok
14062 >>> DATA
14062 <<< 354 Enter mail, end with "." on a line by itself
14062 >>> Received: from ghg_ads.domain1.ghg.org.uk (localhost [127.0.0.1])
14062 >>>       by ghg_ads.domain1.ghg.org.uk (8.13.4/8.13.4) with ESMTP id j45BBLOw014060
14062 >>>       for <david.urquhart@ghg.org.uk>; Thu, 5 May 2005 12:11:21 +0100 (BST)
14062 >>> Received: (from root@localhost)
14062 >>>       by ghg_ads.domain1.ghg.org.uk (8.13.4/8.13.4/Submit) id j45BBLax014059
14062 >>>       for david.urquhart@ghg.org.uk; Thu, 5 May 2005 12:11:21 +0100 (BST)
14062 >>> Date: Thu, 5 May 2005 12:11:21 +0100 (BST)
14062 >>> From: Super-User <root@ghg_ads.domain1.ghg.org.uk>
14062 >>> Message-Id: <200505051111.j45BBLax014059@ghg_ads.domain1.ghg.org.uk>
14062 >>> Content-Type: text
14062 >>> 
14062 >>> Hello From ghg_adds via mail
14062 >>> 
14062 >>> .
14062 <<< 250 M2005050512054603464 Message accepted for delivery
14062 >>> QUIT
14062 <<< 221 netserver2.domain1.ghg.org.uk closing connection.
#

netserver2 is our external mail server, could this email be rejected by them?.





0
 
LVL 40

Accepted Solution

by:
jlevie earned 2000 total points
ID: 13935088
According to that trace the message was delivered to and accepted by netserver2. So if you never saw the email it isn't a problem on this system but rather one on netserver2. So that's where you need to be looking.
0
 
LVL 10

Expert Comment

by:neteducation
ID: 13941166
I agree with jlevie in tht it was delivered and the problem must be searched somewhere else. It could be that some spam/antivirus-filter is classifying your mail as spam/virus because it has a source address in your own domain but is not being sent with authentication. It wouldd however not make sense that you receive the mail through mailx then.

Just to make sure we are not searching at the wrong place: Am I correct that

cat message.txt | mailx david@ghg.org.uk

works, but

cat message.txt | mail david@ghg.org.uk

does not work (when trying with the same message.txt and the same email address ?
0
 
LVL 48

Expert Comment

by:Tintin
ID: 13941379
Just a thought.

The first example given with mailx specified a subject line, whereas the example with mail didn't.  Perhaps there is a spam filter or similar that doesn't like email with no subject.
0
 

Author Comment

by:daveyu
ID: 13943382
I shall have a look at the netsever2 end

Yes, that is correct:-

cat message.txt | mailx david@ghg.org.uk works but

cat message.txt | mail david@ghg.org.uk does not work

As for the subject I have put a line in message.txt such as:

Subject: Hello World.

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13951086
please post results of:

ls -l `which mail`
ls -l `which mailx`
0
 

Author Comment

by:daveyu
ID: 13957929
# ls -l `which mail`
-r-x--s--x   1 root     mail       61328 May  1  2002 /usr/bin/mail
# ls -l `which mailx`
-r-x--s--x   1 root     mail      126880 Oct 18  2001 /usr/bin/mailx
#
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 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