[comp.mail.sendmail] Getting full name from sendmail

ian@airs.com (Ian Lance Taylor) (05/14/91)

I apologize if this is an FAQ, but we don't get this newsgroup here.

This is about sendmail on Ultrix 4.0 on a DECstation 3100.  The
sendmail version seems to be 2.2 Ultrix.  I have no source code.

I've configured sendmail so that all mail that isn't explicitly
addressed locally gets forwarded to our main mail machine.  For
example, my user name is ian and I'm on comton.airs.com.  Mail sent to
``ian@comton.airs.com'' will get delivered locally, but mail sent to
``ian'' will get forwarded to another machine which knows where my
actual mailbox is.

My problem is that sendmail is not inserting my full name in the From:
field, because the $x macro is being set to blank.  The final rule in
ruleset 0 looks like this:

R$+			$#tcp$@$R$:$1

I've discovered that if I change this wildcard entry to deliver to
#local, the $x macro does get set correctly.  However, a line like

R$-			$#tcp$@$R:$1

is enough to clobber the $x macro.  Even

R$-			$1<@$D>

clobbers it.

It seems that sendmail checks whether unqualified user names are
delivered locally and uses this to decide whether to set the $x macro
out of /etc/passwd.

So, my questions:

Am I right as to what is going wrong?

Is there any way to get this approach to work correctly?

Should I be doing something else entirely to forward unqualified user
names?

As I said above, I apologize, but we don't get this newsgroup here.
If you don't e-mail me a response, I won't see it.  Feel free to post
also, if you think it is of general interest.  I am willing to post a
summary of responses if desired.

Many thanks in advance.
-- 
Ian Taylor                   ian@airs.com                  uunet!airs!ian
First person to identify this quote wins a free e-mail message:
``Nobody believed him, so out of politeness to his listeners he pretended
  to be joking.''

ian@airs.com (Ian Lance Taylor) (05/23/91)

Earlier, I asked:

>I've configured sendmail so that all mail that isn't explicitly
>addressed locally gets forwarded to our main mail machine.  For
>example, my user name is ian and I'm on comton.airs.com.  Mail sent to
>``ian@comton.airs.com'' will get delivered locally, but mail sent to
>``ian'' will get forwarded to another machine which knows where my
>actual mailbox is.

>My problem is that sendmail is not inserting my full name in the From:
>field, because the $x macro is being set to blank.

A couple of people asked me to post a summary of responses, so here it
is.  I got very helpful replies from Neil Rickert and Per Hedeland,
for which I thank them profusely.

The problem is that sendmail runs the sender address through ruleset
zero, and only defines the $x macro from the passwd file if the mailer
selected is named ``local'' and if the sender address in the SMTP
envelope matches the From: header exactly.

I only had to make one change on the client machines to get this to
work (and no changes on the server machine).  I changed the definition
of $q to:

Dq$?x$x <$g>$|<$g>$.

This causes the From: line to look like ``From: <ian>''.  This will
then match the SMTP address specified in the ``MAIL FROM'' command.
When the address <ian> is run through ruleset 0 on the server machine,
it will find that is delivered to the mailer ``local'' (so that the
aliases get expanded) and it will insert my full name from the passwd
file on the server machine.

This worked for my situation because I was able to put all our users
into the passwd file on the server machine.  I was told that sites
which can't do this can fix the problem using sendmail 5.65 with the
IDA additions (which is available on uunet and probably other places).
I took a look at this, but the complexity dissuaded me from attempting
it.
-- 
Ian Taylor                   ian@airs.com                  uunet!airs!ian
First person to identify this quote wins a free e-mail message:
``Nobody believed him, so out of politeness to his listeners he pretended
  to be joking.''