Basic Virtual Domains
Sendmail allows to host multiple domains in single instance. The Basic Virtual Domain can be created using local-host-name file. When sendmail receives mail, it needs a way of determining whether it is responsible for the mail it receives. It uses the /etc/mail/local-host-names file to do this. This file has a list of hostnames and domains for which sendmail responsible for mail.
For example, if this mail server was to accept mail for the domains kiran.com and jithu.com then the file would look like this:
In this case, remember to modify the MX record of the jithu.com DNS zonefile point to kiran.com. Here is an example (Remember each "." is important):
# cat /etc/mail/local-host-names
So if we send mail to the user "user1" for both the domain (email@example.com & firstname.lastname@example.org),because of the MX record pointed the mail will reach the same server and as we have configured the local-host-name file sendmail will accept the mail for both the domains. The mail will be delivered to the same user user1 which is a local user.
jithu.com. MX 10 mail.kiran.com.
The mail server will default acceptance of mail for its FQDN defined without the entry in local-host-names.
Virtual users and virtual domains:
This is defined using the virtual user table feature in sendmail configuration.The file used is virtusertable in /etc/mail. While defining the virtusertable the domain name should not exist in local-host-names.
The /etc/mail/virtusertable file contains a set of simple instructions on what to do with received mail. The first column lists the target email address and the second column lists the local user's mail box, a remote email address, or a mailing list entry in the /etc/aliases file to which the email should be forwarded.
If there is no match in the virtusertable file, sendmail checks for the full email address in the /etc/aliases file.
Defining the virtual domains and users (Keep in mind that the exact MX record has been added to respective domains):
VIRTUSER_DOMAIN_FILE(`-o /etc/mail/virtuserdomain') it looks up the various domains that supported by sendmail in this given path.
#compile configuration and restart the sendmail service
#makemap hash virtusertable < virtusertable
#Now restart the sendmail service
Other options in virtusertable: