first of all, i got this by lurking and listening for a long time on the inet-access list, and i also read the o'reilly sendmail book. i finally took the best of all the solutions, and implemented this.
secondly, while the docs now strongly suggest that you maintain the m4 macro files provided, and let them build your sendmail.cf, i have already learned and configured the sendmail.cf directly, so you may want to figure out how to apply these configuration changes to the m4 stuff.well, here goes:
1) it is assumed at this point that you have a domain registered with the internic, with the proper dns entries, including the mx, and secondary dns arranged somewhere. let's assume virtdomain.com for any examples here, with the original domain as mydomain.com.
2) make an entry in the /etc/sendmail.cw file to tell sendmail to accept mail for this domain:
virtdomain.com
3) configure a file for the virtual host domains, and one for the return mail masqs. virtualhosts.db will hold the descriptions of how to deliver mail to the virtual domain(s). virtualmasqs.db will hold descriptions of how to re-write users' return addresses to the virtual host, so they don't even have to re-configure their mail clients. to do this, add the following 2 lines to the sendmail.cf file, just after the Cw /etc/sendmail.cw entry:
Kvirtualhosts btree /etc/virtualhosts.db
4) add the following rule set 40 for the return mail masq:
S40
R$* < @ $* > $*[tab]$@ $1 < @ $2 > $3[tab]already fully qualified
5) add the following rule set 98 for the virtual hosts:
S98
#################################
R$+ < @ $+ . >[tab]$: $1 < @ $2 > .
5) create /etc/virtualhosts with your favorite text editor:
virtdomain.com frank@mydomain.com
6) create the database virtualhosts.db from virtualhosts with the
makemap command (makemap comes with sendmail):
makemap btree virtualhosts.db < virtualhosts
7) create /etc/virtualmasqs:
frank frank@virtdomain.com
8) create the database virtualmasqs.db from virtualmasqs with the
makemap command (makemap comes with sendmail):
makemap btree virtualmasqs.db < virtualmasqs
9) since the sendmail.cf file was modified/recreated, you must kill
sendmail and re-start it.
finis) your configuration should be finished and functional. from now
on, whenever you create new virtual hosts, you only need to add the
appropriate lines to the virtualhosts and virtualmasqs files and
re-make the databases.
hope this is helpful! &*)
cheers,
PS:
if you have any questions or comments reguarding mail setup for virtual
domains, please feel free to e-mail me at:
jeffrl@wantabe.com
#bc instead of automatically using $M, lookup masquerade in virtualmasqs
R$*[tab]$: $(virtualmasqs $1 $: $1 @ $M $)
#bcR$*[tab]$: $1 @ $M[tab]add local qualification
R$* @[tab]$: $1 @ $j[tab]if $M not defined
# new stuff for virtual domains #
#################################
R$+ < @ $+ > $*[tab]$: $(virtualhosts $1@$2 $: $1 < @ $2 > $3 $)
R$+ < @ $+ > $*[tab]$: $(virtualhosts $2 $: $1 < @ $2 > $3 $)
R$+ < @ $* > . [tab]$: $1 < @ $2 . >
gloria@virtdomain.com gloria@mydomain.com
webmaster@virtdomain.com fred@someother.domain.com
gloria gloria@virtdomain.com
fred fred@virtdomain.com
jeff