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 ?

sylye
  • 250
  • 2
  • 5
  • 13

2 Answers2

4

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.

Esa Jokinen
  • 52,963
  • 3
  • 95
  • 151
1

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:

masegaloeh
  • 18,498