Solved

Postfix user with multiple domains

Posted on 2011-03-15
7
555 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 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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