# Sendmail host multiple domains



## fullauto2012 (Feb 23, 2018)

I just had a friend of mine as if I can host a couple of email addresses for him. I have a domain already with sendmail working and properly masqueraded. But I'm unsure how to host multiple domains. Do I simply add the domain to the access, relay-domains, and local-host-names files and run make?


----------



## obsigna (Feb 24, 2018)

I cannot tell anything for sendmail(8). However, in the mail/postfix documentation there is a whole chapter about the various technics of multiple domain hosting and its pro's and con's. *While the very details are different between Postfix and Sendmail*, the concepts should/might be similar, though. Perhaps you can grasp some ideas on how to proceed with Sendmail.

Postfix Virtual Domain Hosting Howto: http://www.postfix.org/VIRTUAL_README.html

For example the most simple solution for postfix is to add the other domains to the mydestination rule. This seems to be similar to your idea of simply informing additional domains to the respective sendmail settings. Let´s say the domains are example.com and elpmaxe.moc. The problem with this simple setup would be that e-mails to rolf@example.com and rolf@elpmaxe.moc address the same user rolf.


----------



## drhowarddrfine (Feb 24, 2018)

obsigna No, he cannot use postfix to help with this. I'm going to bed and intend to have a lousy weekend. If I have the chance, I'll post how we do it unless, hopefully, someone else does.


----------



## nforced (Feb 24, 2018)

I agree Postfix should be used over Sendmail for a large number of reasons, mainly configuration. Do whatever's needed to migrate.


----------



## drhowarddrfine (Feb 25, 2018)

I'm having a lousy weekend and it will continue into this week so I hope I post this correctly.

1) edit /etc/mail/local-host-names to include the other domain names. Simple, `example.com` will do.
2) Assuming the mail is just being forwarded to something like gmail, add the from/to addresses to /etc/mail/virtusertable. Example:

```
joe@yourdomain.com joe@gmail.com

bob@hisdomain.com  bob@gmail.com
```

3) do `makemap hash virtusertable < virtusertable` to create that database for the new users.

4) Restart sendmail `service sendmail onerestart` and send a test email.

I have not included information on how to handle MX records on your nameserver.


----------



## ShelLuser (Feb 25, 2018)

Well, Drhoward beat me to it. One small addition though: it might be easier to simply issue `# make maps` to activate virtusertable. This will do the same thing but uses an (IMO) easier to remember command.

I also would like to share my strong disagreements about Postfix over Sendmail. While it is true that Sendmail has a bit of a learning curve where its configuration goes, fact of the matter is that once you grasp its basics (which... really isn't all _that_ difficult) then you may well end up with an MTA which is far more flexible and tunable than Postfix is.

There are situations in which you'd have to rely on another delivery agent (procmail comes to mind) while Sendmail has out of the box support for them, msp being one of them.

Just for the record: I use both Sendmail and Postfix and it's that experience which I base my opinion on.


----------



## fullauto2012 (Mar 1, 2018)

So, essentially you just tell sendmail you will accept mail for the new domain (edit local-host-names), add the domain to the friendly list (access), create a virtual user (edit virtual user table), and send map the address to a local account?

Am I getting all the right?


----------

