Can I use /etc/aliases for multiple domain mail server?
Solution 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:
Solution 2
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/name
s, |commands
or even :include: /path/name
s.
If the aliases are always the same on every domain, /etc/aliases
is just fine. If you need different destinations for [email protected]
and [email protected]
, you need to use virtual aliases. In Postfix it can be done with virtual_alias_maps.
Related videos on Youtube
Comments
-
sylye almost 2 years
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:[email protected]: info [email protected]: info
Or I can't do like that and have to use the setup described over here : Sendmail multi domain, Postfix multi domain ?
-
Federico Sierra over 9 yearsTake a look in serverfault.com/questions/171616/…
-
-
sylye over 8 yearsAnd to set the
aliases
correctly, I should just need to put one entry sincealiases
will not care what is the domain name after the '@', which mean by usingaliases
, 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. -
Esa Jokinen over 8 yearsIf every domain has exactly the same mailboxes, it is possible. However, if you need even one exception, use virtual alias domains instead.