sendmail.cf

Frank W. Peters peters at cc.msstate.edu
Thu Nov 16 04:27:08 AEST 1989


> Is it possible to change the sendmail.cf file to indicate a different
> host for different local users?
>
> For example: if user1 sends mail the return address looks like user1 at host1;
> but, if user2 sends mail it has the return address user2 at host2 (even though
> they are working on the same machine).

Yes it is.  Here at msstate we have that configured for several machines.
If I send mail from any of these machines the from address is given
as <peters at CC.MsState.Edu> even if I send from, for instance, a Computer
Science machine.  If a colleage in the CS department sends mail from those
same machines his/her From address would be <user at CS.MsState.Edu>.

Am I correct that this is what you want?

If so here is how we accomplish this:

we have several files of users based on what from address they want (in our
case, based on what department they are in).  Fro instance /usr/lib/cc.users
lists all of the users on a machine who are associated with the computing 
center. Userids are listed one per line.

Near the beginning of sendmail.cf  we read each file into a variable thus:

...
FJ/usr/lib/cc.users
Fk/usr/lib/cs.users
FL/usr/lib/ae.users
...

Thus the sendmail class J contains the names of all of the users in cc and so
on.

Now we go to the final sender rewriting rule for our mailer (tcp in our case,
probably uucp or some such for you).

S9
...
R$*$=J		$@$1$2 at CC.MsState.Edu
R$*$=K		$@$1$2 at CS.MsState.Edu
R$*$=L		$@$1$2 at AE.MsState.Edu
...

And all users listed in class J have CC.MsState.Edu appended as their host
name.  One point to note is that I have our mailer configured so that local
sender's addresses have no host portion when they are passed to the mailer
for final rewriting.  In your case you quite likely have the 'real' hostname
appended at that point.  In that case you may have to modify the above
slightly thus:

R$*$=J@$j	$@$1$2 at CC.MsState.Edu

Where $j is the machines real hostname.  Note also that we've placed a default
case at the end of S9 that appends the real host name if the userid isn't
found in any of the groups (mistakes happen :-).  You won't need that, though,
if you get the addresses in your mailer with the hostname already attached.

If you can't figure out how to set up what you want from this feel free to 
write me.  If you send a copy of your current sendmail.cf I may be able to
offer more precise suggestions

Good Luck
--Frank
~~~~~~~~
Frank Wayne Peters            $ Peters at CC.MsState.Edu $ "It helps to have a
Systems & Networks Programmer $ Peters at MsState.Bitnet $  sense of humor about
Computing Center & Services   $ Phone: (601)325$2942  $  all of this."
Post Office Drawer CC         $ FAX:   (601)325$3299  $     -- Life With UNIX
Mississippi State, MS 39762   $ Room 147 Allen Hall   $



More information about the Comp.unix.questions mailing list