Subject: Re: Help with sendmail on NetBSD-1.5.2
To: B. James Phillippe <bryanxms@ecst.csuchico.edu>
From: Frederick Bruckman <fredb@immanent.net>
List: netbsd-help
Date: 12/02/2001 23:52:52
On Sun, 2 Dec 2001, B. James Phillippe wrote:

> I am hoping someone could offer me some quick help with sendmail on
> NetBSD-1.5.2.  I am setting up a mail server to receive email for multiple
> domains and I can't figure out how to get sendmail to accept this.  In
> older versions, there was a setting to specify a file that contained
> alternate domains.  Any advice?
>
> Also, in this version of the config file, I see these values:

Sounds like you want this one...

> # Virtual user table (maps incoming users)
> Kvirtuser hash -o /etc/mail/virtusertable

However, it's best not to try to edit "sendmail.cf" directly. Instead,
create a simple ".mc" file and run "m4" over it. In most cases, after
you upgrade sendmail, you'll be able to use the same file to
regenerate a "sendmail.cf" with all the latest features.

E.g., say you have a mailhost "somehost.somedomain", which MX's for
"somehost.someotherdomain" and "somehost.stillanotherdomain". So you'd
create a file "/etc/mail/SOMEHOST.mc"...

divert(0)
define(`_CF_DIR_', `/usr/share/sendmail/')
include(`/usr/share/sendmail/m4/cf.m4')
VERSIONID(`@(1.0.0)SOMEHOST.mc')
OSTYPE(`bsd4.4')dnl
DOMAIN(`generic')dnl
FEATURE(`virtusertable', `hash /etc/mail/virtusertable')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl
DAEMON_OPTIONS(`Family=inet, address=0.0.0.0, Name=MTA')dnl
DAEMON_OPTIONS(`Family=inet6, address=::, Name=MTA6, Modifiers=0')dnl
define(`confDOMAIN_NAME', `somedomain')dnl

back up "/etc/mail/sendmail.cf", and run

	m4 /etc/mail/SOMEHOST.mc >/etc/mail/sendmail.cf"

Now the "/etc/mail/virtusertable" could look like this...

@somehost.someotherdomain	%1@somehost.somedomain
@somehost.stillanotherdomain	%1@somehost.somedomain

The "%1" means that the users will have the same user name on the real
host as on the virtual host. You could also use complete email
addresses on the lhs and rhs. All this, and more, is described in
"/usr/share/sendmail/README". "/usr/share/sendmail" also contains
sample ".mc" files.

Now "sendmail" doesn't actually look at the plaintext file; you have
to create "/etc/mail/virtusertable.db" for "sendmail"'s benefit:

	cd /etc/mail/
	makemap hash virtusertable < virtusertable

Changes to the ".db" files take effect immediately -- you don't even
need to restart "sendmail".

Frederick