Solved

Postfix user with multiple domains

Posted on 2011-03-15
7
549 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:scarpenter104
  • 4
  • 3
7 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35142798
Yes, it is possible.

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
0
 
LVL 1

Author Comment

by:scarpenter104
ID: 35144722
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.
0
 
LVL 31

Accepted Solution

by:
farzanj earned 500 total points
ID: 35147120
Ok, here is the problem.  It was Sendmail syntax and I thought it might be same.

Now you have to do this:
1.  Try removing %1 and see what happens.
2.  Whether it works or not try the second suggestion I have.


In your postfix config file, make sure the following map is enabled.
smtp_generic_maps = hash:/etc/postfix/generic

Now, insert this line (modify domain names) into /etc/postfix/generic
@dom1.com      @dom2.com


  Please let me know about both of these.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Author Comment

by:scarpenter104
ID: 35149538
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.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35149785
I am so glad it worked.

Where did you do "postmap generic"?  Please clarify.  I normally use sendmail.
0
 
LVL 1

Author Comment

by:scarpenter104
ID: 35159833
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.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35160465
Oh, ok.  Thanks for for your response.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question