Scott Carpenter
asked on
Postfix user with multiple domains
I have a client who has multiple domains but wants to run them as alias domains. I use Postfix as my incoming mx and direct mail into destination servers from there. I would like to use the virtual_alias_maps to redirect the incoming mail to the main domain regardless of the domain it was addressed to.
The thing I'm looking for is something that would say, "send {any user}@domain2.com to {same user}@domain1.com" so I don't have to put in an individual line for each user.
Is this even possible?
The thing I'm looking for is something that would say, "send {any user}@domain2.com to {same user}@domain1.com" so I don't have to put in an individual line for each user.
Is this even possible?
ASKER
Using the suggested syntax, the server actually tries to deliver the mail to the literal:
%1@anotherdomain.com
I assume %1 is supposed to resolve but it does not.
%1@anotherdomain.com
I assume %1 is supposed to resolve but it does not.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Both suggestions work perfectly.
The generic file (I assumed I also had to do a "postmap generic", which I did) gave a slight twist:
Since the first method works on the recieve side it showed up in the logs as delivered to (user@dom2.com (originally user@dom1.com). The second method operates on the delivery side so it simply showed user@dom1.com in the log but delivered the mail to user@dom2.com.
Additionally, in the mail client, the first method maintained the actual sending domain and showed it was sent to user@dom1.com, while the second showed that it was sent to user@dom2.com.
Two excellect solutions that each are perfect for certain situations.
Thanks for the solutions.
The generic file (I assumed I also had to do a "postmap generic", which I did) gave a slight twist:
Since the first method works on the recieve side it showed up in the logs as delivered to (user@dom2.com (originally user@dom1.com). The second method operates on the delivery side so it simply showed user@dom1.com in the log but delivered the mail to user@dom2.com.
Additionally, in the mail client, the first method maintained the actual sending domain and showed it was sent to user@dom1.com, while the second showed that it was sent to user@dom2.com.
Two excellect solutions that each are perfect for certain situations.
Thanks for the solutions.
I am so glad it worked.
Where did you do "postmap generic"? Please clarify. I normally use sendmail.
Where did you do "postmap generic"? Please clarify. I normally use sendmail.
ASKER
generic is a text file and we specified a hash in the config:
smtp_generic_maps = hash:/etc/postfix/generic
So after creating the text file you use:
postmap generic
to create the generic.db that postfix looks for.
smtp_generic_maps = hash:/etc/postfix/generic
So after creating the text file you use:
postmap generic
to create the generic.db that postfix looks for.
Oh, ok. Thanks for for your response.
First find the name of the table in your postfix system.
grep virtual_alias_maps /etc/postfix/main.cf | cut -d: -f2
Make sure that virtual_alias_maps line is not commented.
If you don't have it, put something like
virtual_alias_maps = hash:/etc/postfix/virtual
Once you find out what the name of the file is, you should put the following entry:
@mydomain.com %1@anotherdomain.com