Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!aplcen!haven!adm!xadmx!peters@cc.msstate.edu From: peters@cc.msstate.edu (Frank W. Peters) Newsgroups: comp.unix.questions Subject: Re: sendmail.cf Message-ID: <21461@adm.BRL.MIL> Date: 15 Nov 89 17:27:08 GMT Sender: news@adm.BRL.MIL Lines: 69 > 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@host1; > but, if user2 sends mail it has the return address user2@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 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 . 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@CC.MsState.Edu R$*$=K $@$1$2@CS.MsState.Edu R$*$=L $@$1$2@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@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@CC.MsState.Edu $ "It helps to have a Systems & Networks Programmer $ Peters@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 $