Using Sendmail genericstable to map users to different domains

To run multiple domains on one machine, I haven’t found it possible to selectively use domain masquerading to set the correct domain name for email accounts that are part of each domain. However, the genericstable approach allows you to remap email addresses to alternative addresses as emails are sent:

Add these statements to your /etc/mail/sendmail.mc file to enable genericstable:

FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl

GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl

Create a /etc/mail/generics-domains file that contains a list of the domains that are to be processed when remapping addresses.

For example:

example1.com

example2.com

Create the /etc/mail/genericstable file. For example:

username       username@different-domain.com

Rebuild the genericstable.db file:

makemap hash /etc/mail/genericstable.db < /etc/mail/genericstable

Rebuild your sendmail config using m4 (see other post here).

Restart your sendmail server.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.