Virtusertable is used to do aliases to virtual domains hosted on the same server I'll use freebsd.org and freebsdhelp.org as examples in my article as freebsd.org is the main box and freebsdhelp.org is the
virtual domain hosted on freebsd.org.
*=- The easy way assuming sendmail.cf compiled with the correct features:
Most recent sendmail source are compiled with the needed FEATURES such as
"FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')dnl" and "FEATURE(access_db, `hash -o /etc/mail/access')dnl" in the sendmail.mc file assuming you installed freebsd normally with
sendmail which these features are already included in the freebsd.mc (/usr/src/etc/sendmail/freebsd.mc) 3 steps is needed to do virtual email aliasing for freebsdhelp.org over freebsd.org main box
your sendmail.cw with any text editor such as vi(1) or ee(1) and place all domains that uses sendmail as their mailer deamon in this file, usually at
or /etc/mail/sendmail.cw list them , save and exit.
* your sendmail.cw will look like this listening:
- YOU NEED TO RESTART SENDMAIL TO READ THE NEW ENTRIES SEND A SIGNAL HUP TO SENDMAIL
BY 'killall -HUP sendmail'
2. you have to make access for the virtual domain to access your sendmail by adding them
to /etc/mail/access file and making the database file access.db .
* your /etc/mail/access will look something like this here seperating the domainname and
RELAY with <TAB>
* save and exit and then you have to create access.db while your at /etc/mail/ do this
- makemap hash access < access
- YOU HAVE TO UPDATE YOUR 'access.db' EVERYTIME YOU
ADD NEW DOMAIN , PLUS YOU DON'T HAVE
TO RESTART SENDMAIL.
3. Finally to the virtusertable file edit the file /etc/mail/virtusertable and start your aliases there i'll mention some examples of
A. assume you want to alias firstname.lastname@example.org to other LOCAL user on the same server
*MAKE SURE ALL ENTRIES ARE SEPERATED WITH <TAB>* :
B. assume you want to alias email@example.com to
other FOREIGN user on other server:
C. assume you want to alias all emails coming on freebsdhelp.org to one LOCAL user and
still you want your firstname.lastname@example.org and email@example.com works:
D. the same of the above but to a FOREIGN user:
* save and exit and then you have to create virtusertable.db while your at /etc/mail/ do this
- makemap hash virtusertable < virtusertable
- YOU HAVE TO UPDATE YOUR 'virtusertable.db' EVERYTIME YOU
ADD NEW ALIASES , PLUS YOU DON'T
HAVE TO RESTART SENDMAIL.
*=- The hard way if your sendmail.cf is compiled without correct features:
A. First of all you have to creat your
sendmail.mc including the following to enable virtual hosting with sendmail:
FEATURE(access_db, `hash -o /etc/mail/access')dnl
FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')dnl
adding them to your sendmail.mc compile it and install it while this article isn't a sendmail installation guide i wont talk more about it, for more info on SENDMAIL(8) can be found at http://www.sendmail.org
B. Go back to the first section and continue the job.