Date: Fri, 25 Oct 1996 16:47:43 -0400 (EDT) From: Steve <shovey@buffnet.net> To: freebsd-questions@FreeBSD.ORG Subject: virtual domains for email. Message-ID: <Pine.BSI.3.95.961025164707.25002C-100000@buffnet11.buffnet.net>
next in thread | raw e-mail | index | archive | help
I keep seeing this question posted - below is a post I saved that explains
how to do virtual email domains
---------- Forwarded message ----------
Date: Thu, 15 Aug 1996 22:39:30 -0400 (EDT)
From: Mark Mathis <mark@earth.mat.net>
To: "Jun, Gyu-Chang" <geoid@ktnet.co.kr>
Cc: questions@freebsd.org
Subject: Re: Virtual mail hosting?
On Fri, 16 Aug 1996, Jun, Gyu-Chang wrote:
> 
>   Now, here is the question. Is it possible to set up virtual mail host?
>   I think if I set Cw record in sendmail.cf, aaa@www.aaa.com and
>   bbb@www.bbb.com can be handled. My point is that ONE FBSD box can accept
>   mail for webmaster@www.aaa.com and webmaster@www.bbb.com simutaneously..
> 
What you will need to do is first modify sendmail.cf to deal with two 
databases in the /etc directory that will handle the aliasing.
add these two lines to sendmail.cf
Kvirtualhosts btree /etc/virtualhosts.db
Kvirtualmasqs btree /etc/virtualmasqs.db
add this rule set for the return mail masq
S40
     
R$* < @ $* > $*         $@ $1 < @ $2 > $3       already fully qualified
#bc instead of automatically using $M, lookup masquerade in virtualmasqs
R$*                     $: $(virtualmasqs $1 $: $1 @ $M $)
#bcR$*                  $: $1 @ $M              add local qualification
R$* @                   $: $1 @ $j              if $M not defined
add this rule set for the virtual hosts
S98 
################################
# sendmail for virtual domains #
################################
R$+ < @ $+  . >         $: $1 < @ $2 > .
R$+ < @ $+ > $*         $: $(virtualhosts $1@$2 $: $1 < @ $2 > $3 $)
R$+ < @ $+ > $*         $: $(virtualhosts $2 $: $1 < @ $2 > $3 $)
R$+ < @ $* > .          $: $1 < @ $2 . >
for inbound mail:
create /etc/virtualhosts with your favorite text editor, there can be 
as many lines as you want for each virtual host.
virtdomain.com			john@mydomain.com   (all mail goes to john)
sam@virtdomain.com		sam@mydomain.com
webmaster@virtdomain.com	bob@other.domain.com (forward mail to 
							third system)
create the database virtualhosts.db from virtualhosts with the makemap 
command (makemap comes with sendmail)
makemap btree virtualhosts.db <virtualhosts
for outbound mail (they need an account on your system)
create /etc/virtualmasqs (if you use PINE do this in setup)
frank	frank@virtdomain.com
gloria	gloria@virtdomain.com
fred	fred@virtdomain.com
create the database virtualmasqs.db from virtualmasqs with the makemap 
command
makemap btree virtualmasqs.db <virtualmasqs
****************************************
EACH TIME YOU ADD ANOTHER VIRTUAL DOMAIN
****************************************
(this is from part of the instructions I give sysop's on our system)
5. Add Cw line in /etc/sendmail.cf
	Cw new.domain.com
6. Add alias to /etc/virtualhosts
	webmaster@new.domain.com	account@real.domain
	run command:
	makemap btree virtualhosts.db < virtualhosts
7. if they have an account on our machine and want mail to look like it 
is coming from their domain.
	add alias to /etc/virtualmasqs
	username	anyname@new.domain.com
	run command:
	makemap btree virtualmasqs.db < virtualmasqs
8. restart sendmail
	get the pid with
	ps -aux | grep sendmail
	run command:
	kill -HUP sendmail.pid
******************************************************************************
  /\	Mark Mathis	Micro Access Technologies  "Behind every successful
 /\/\	Mark@Mat.Net	PO Box 92224               cat is an obedient owner"
/\/\/\	202/529-5001	Washington, DC  20090
******************************************************************************
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.95.961025164707.25002C-100000>
