From owner-freebsd-questions Thu Jul 16 11:43:57 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA24957 for freebsd-questions-outgoing; Thu, 16 Jul 1998 11:43:57 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from mixwarecorp.com (tsmia2-90.gate.net [199.227.186.90]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA24944 for ; Thu, 16 Jul 1998 11:43:47 -0700 (PDT) (envelope-from fajardo@gate.net) Received: from gate.net (mixwarecorp.com [192.168.1.1]) by mixwarecorp.com (8.8.8/8.8.7) with ESMTP id CAA01613 for ; Fri, 17 Jul 1998 02:26:39 -0400 (EDT) (envelope-from fajardo@gate.net) Message-ID: <35AEEE9C.D4FCA4A7@gate.net> Date: Fri, 17 Jul 1998 02:26:37 -0400 From: Geovanny Fajardo Reply-To: fajardo@gate.net X-Mailer: Mozilla 4.04 [en] (X11; I; FreeBSD 2.2.6-RELEASE i386) MIME-Version: 1.0 To: freebsd-questions@FreeBSD.ORG Subject: Sendmail Virtual Host Rule Sets Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I found this message in the archives and it was very useful to me, but I still had some problems getting sendmail to work so I modified this message with the information I used to get sendmail working for me. I'm using FreeBSD 2.2.6-RELEASE. Remember that sendmail.cf has a very sensitive sintax so do not forget to use tabs for places where you see more than one space between characters. 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. 1) Add these two lines to sendmail.cf Kvirtualhosts btree /etc/virtualhosts.db Kvirtualmasqs btree /etc/virtualmasqs.db 2) Add this rule sets for the return mail masq S40 R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified R$* $: $(virtualmasqs $1 $: $1 @ $M $) R$* @ $: $1 @ $j if $M not defined S61 R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified R$=E $@ $1 < @ $j> R$+ $: $(virtualmasqs $1 $: $1 @ $M $) R$* @ $: $1 @ $j if $M not defined 3) 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 . > 5) For inbound mail: a) 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) b) Create the database virtualhosts.db from virtualhosts with the makemap command (makemap comes with sendmail) makemap btree virtualhosts.db < virtualhosts 6) For outbound mail (they need an account on your system) a) Create /etc/virtualmasqs frank frank@virtdomain.com gloria gloria@virtdomain.com fred fred@virtdomain.com b) Create the database virtualmasqs.db from virtualmasqs with the makemap command makemap btree virtualmasqs.db