Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!swrinde!ucsd!nosc!crash!ncr-sd!se-sd!bhoule From: bhoule@se-sd.SanDiego.NCR.COM (Bill Houle) Newsgroups: comp.sys.ncr Subject: Re: mailx question Message-ID: <4018@se-sd.SanDiego.NCR.COM> Date: 12 Oct 90 07:40:19 GMT References: <90284.094041TEMNGT23@ysub.ysu.edu> Organization: NCR Corporation, Systems Engineering - San Diego Lines: 63 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_ 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