?
Solved

Postfix user with multiple domains

Posted on 2011-03-15
7
Medium Priority
?
578 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

 
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

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

770 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