0

I have server1.com and server2.com both pointing to the same server. I wish to make all email sending to @server1.com and @server2.com going to the same mailbox in that particular server.

I searched around in the Internet and found out I need to configure virtual domain for the MTA no matter it's Sendmail or Postfix.

I wonder can I just use /etc/aliases for such purpose ? For example:

info@server1.com:  info
info@server2.com:  info

Or I can't do like that and have to use the setup described over here : Sendmail multi domain, Postfix multi domain ?

3

YES

For postfix you need to ensure these two parameters

alias_maps = hash:/etc/aliases
mydestination = domain1.com domain2.com

As postfix has many similiarities with sendmail (including /etc/aliases support), then you can use same /etc/aliases. The sendmail equivalent setting for postfix-mydestination is putting the domains to /etc/mail/local-host-names. For example

# local-host-names - include all aliases for your machine here.
domain1.com
domain2.com

References:

  • And to set the aliases correctly, I should just need to put one entry since aliases will not care what is the domain name after the '@', which mean by using aliases, I can only make all emails with the same name but different domain go to the same destination. This answer has elaborated it quite well. – sylye Dec 1 '15 at 8:15
3

You cannot use /etc/aliases for virtual alias domains, so your syntax is wrong. Correct syntax is:

name: addr_1, addr_2, addr_3, . . .

Where name has to be the alias, the part before @. What's after the @depends on what is configured in mydestination (Postfix) or /etc/mail/local-host-names (Sendmail). There, you can have the list of your domain names.

Then, the addr_1 etc. can be local usernames, local /path/names, |commands or even :include: /path/names.

If the aliases are always the same on every domain, /etc/aliasesis just fine. If you need different destinations for info@example.com and info@example.org, you need to use virtual aliases. In Postfix it can be done with virtual_alias_maps.

  • So on whether can we use aliases to achieve the multi mail domain setup is, whether the destination is the same or not. – sylye Dec 1 '15 at 8:07
  • If every domain has exactly the same mailboxes, it is possible. However, if you need even one exception, use virtual alias domains instead. – Esa Jokinen Dec 6 '15 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.