[comp.sys.ncr] mailx question

TEMNGT23@ysub.ysu.edu (Lou Anschuetz) (10/11/90)

Our NCR Tower 32/700 with UNIX V 1.03 is working quite nicely
to send and receive mail via TCP/IP.  When it receives mail from
another machine the mail daemon handles it correctly.  A mail
header has the form:

      From root
      >From: otherguy@otherplace

The only problem is that with mailx if you ask for the headers,
all mail delivered via the mail daemon reports having come from
root rather than the actual sender.  If you use the reply option
then the mail does go the correct person.  For complicated reasons,
however, I need to extract the sender from the header line
rather than using the reply option.  Does anyone have any idea
why mailx is not correctly reporting the actual sender? -or,
any way to correct the problem?  (We observe that mail on our
RISC/6000's, on our Encore Multimax and on our UTS system all
report the correct information when asked for headers....)

Thanks in advance
Lou Anschuetz
   temngt23@ysub.ysu.edu
   temngt23@ysub.bitnet
   root@yfn.ysu.edu

bhoule@se-sd.SanDiego.NCR.COM (Bill Houle) (10/12/90)

In <90284.094041TEMNGT23@ysub.ysu.edu> TEMNGT23@ysub.ysu.edu (Lou Anschuetz) writes:

>Our NCR Tower 32/700 with UNIX V 1.03 is working quite nicely
>to send and receive mail via TCP/IP.  When it receives mail from
>another machine the mail daemon handles it correctly.  A mail
>header has the form:
>
>      From root
>      >From: otherguy@otherplace
>
>The only problem is that with mailx if you ask for the headers,
>all mail delivered via the mail daemon reports having come from
>root rather than the actual sender.

Actually, you probably get something more like this:

	From root _date_
	>From otherguy@otherplace _date_
	 <other headers omitted>
	From: otherguy@otherplace (real name)

Mailx typically uses the From_ line and not the From: line when
determining the sender address.  The second From_ is correct, but
unfortunately /bin/mail "comments it out" so mailx doesn't recognize
it.  Notice, however, that the From: line is perfect and unmangled.
To avoid the problem you are encountering, use another mail user
agent (such as Mush or Elm) that recognizes From: instead of From_.
If you don't like that answer, then read on....

The culprit in this case is /bin/mail, which is pretty much
brain-dead on all SysV boxes (the comments in sendmail.cf say as
much).  /bin/mail as delivered with the OS is not equipped to
understand external addresses and assumes that everything is a user
on the local system; this local user is simply determined by
$LOGNAME at the time of invocation.  To see what I mean, try this:

	% setenv LOGNAME 'bush@whitehouse.gov'
	% /bin/mail < some_file

Check your mail, 'cause you've got a letter from the President!  In
summary, /bin/mail is easily fooled.  It comments out any valid
From_ lines and adds its own according to the $LOGNAME of the
invoker.  Since sendmail is running as root, all incoming mail is
"From root".

The best solution is to get a better mail transport agent (a
replacement for /bin/mail), such as smail.  If that is too extreme
for your purposes, you could write a quick hack that:

 1) reads the first line of the sendmail generated mail
    (From user@node Fri Oct 12 00:08:15 PDT 1990)
 2) extracts the *real* address (user@node)
 3) sets $LOGNAME to this correct address
 4) pipes the remainder of the message to /bin/mail

From there, set the local delivery agent in sendmail.cf to this
kludge program (it is currently set to /bin/mail), and you are ready
to go.  It's a pretty trivial program to write, but I can send/post
mine if interested.

--
Bill Houle                       bhoule@se-sd.SanDiego.NCR.COM
NCR SE-San Diego                 (619) 693-5593