rick@tse.uucp (11/14/89)
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).
--
Rick Yazwinski (geac!tse!rick) | Sarete liberi dalla schiavitu`!
Advanced Systems Division | E cosi diverrete tutti liberi!
The Toronto Stock Exchange | Pero uomini e donne
| Sarete tutti nudi, per fino.
jik@athena.mit.edu (Jonathan I. Kamens) (11/15/89)
In article <1989Nov13.193000.12827@tse.uucp> rick@tse.uucp writes: >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. Define several classes read from files in the sendamil.cf file; each class represents all the users who should be from one particular host. Then, in the sender pre-write you match against each of those classes and tack on the appropriate host for any matches. I'm assuming that you don't want to tack a host on if the user has manually specified the host himself -- if the user specifies the from host, then he really wants mail to go there :-). If you want to enforce the host divisions, you need to strip off any host specified by the sender before matching against the classes. The level of paranoia and care you take in doing this is up to you. Of course, you can do the same thing for recipients if you want mail to automatically be delivered to the right host, given only the username. All of this is a little dangerous, because you have to keep all these files up-to-date on all of the hosts involved. It's usually a better idea, when a somewhat large number of hosts is involved, to have a central machine that knows all the usernames, and to forward all mail to that machine for delivery, instead of trying to put correct hosts in the sender field. Give that machine an automatically generated aliases file that forwards mail to the appropriate mail hosts. (That's how Project Athena mail works. Athena.mit.edu is actually just a mailhub which does mailing list expansion and mail delivery to Athena users, whose mail actually lives on several post office machines.) Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710
peters@cc.msstate.edu (Frank W. Peters) (11/16/89)
> 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 <peters@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@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@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 $