Using Genericstable feature for rewriting outgoing mail addresses

Add the following to the sendmail m4 file
FEATURE (`genericstable') 
GENERICS_DOMAIN_FILE (`/etc/mail/generics-domains') 
The m4 file on solaris 9 can be found in /usr/lib/mail/cf

The standard server sendmail m4 file is called main.mc. If this is the first time you have edited it, copy it to a different filename so that you know that it is not the standard one, eg myconfig.mc

If however you already have a custom sendmail file, eg in this case myconfig2.mc, copy it to new filename eg myconfig3.mc

previously the file myconfig2.mc looked like :

divert(-1)
#
#

divert(0)dnl
VERSIONID(`@(#)myconfig.mc	1.0 (JAW) 05/05/03')
OSTYPE(`solaris8')dnl
DOMAIN(`solaris-generic')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl
FEATURE(`access_db')dnl
MASQUERADE_AS(`mydomain.com')dnl

Now the file myconfig3.mc looks like:


divert(-1)
#
#

divert(0)dnl
VERSIONID(`@(#)myconfig.mc	1.0 (MYCONFIG) 05/05/03')
OSTYPE(`solaris8')dnl
DOMAIN(`solaris-generic')dnl
FEATURE(`always_add_domain')dnl
FEATURE(`access_db')dnl
FEATURE(`genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl
Note the extra FEATURE line to add the genericstable feature.

Edit the Makefile to make the new config file as well as the standard main.cf and subsidiary.cf.

run make to make the new custom sendmail config file - this will be called myconfig3.cf

copy the new config file to /etc/mail/sendmail.cf

edit /etc/mail/generics-domains to add the domain name that gets set by default, typically the hostname

eg,

myhost.mydomain.com

edit /etc/mail/genericstable to add the users that you want to rewrite outgoing mail for
eg

fred fred@mydomain.com
tom tom_jones@hisdomain.com
bill billybob@myotherdomain.com

Now we need to make the access table into a map. There are different formats like hash dbm etc. These can be seen by typing 'makemap -l'. The default is type hash which will produce a .db file.

# makemap hash /etc/mail/genericstable < /etc/mail/genericstable

then restart Sendmail. (# /etc/rc2.d/S88sendmail stop; /etc/rc2.d/S88sendmail start
done !