Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently did some work for somebody, and as a side, he asked me if it was possible to have postfix forward mail from one server to another for the same domain. For example, let's say his domain is example.com and he has an MX record that points to linux.example.com. He has some mailboxes hosted on linux.example.com and other ones hosted on windows.example.com. He wants any undeliverable mail that reaches linux.example.com to be forwarded to windows.example.com, still @example.com, of course.

Example scenario:

  • linux.example.com hosts bob@example.com
  • windows.example.com hosts tom@example.com
  • MX records point to linux.example.com
  • A user sends an e-mail to tom@example.com. Postfix (on the GNU/Linux machine) sees that it doesn't have a user named tom and registers an undeliverable. Rather than responding to the requestor with an undeliverable message, the user wants the data to be forwarded on to windows.example.com.

He is willing to create a record for every e-mail that resides on the Windows machine if necessary, but he would prefer that it always just forward undeliverables to the Windows machine so that he doesn't have to create a record every time he makes a new mailbox on the Windows server.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted
+50

If I understood your problem correctly I think you can do it configuring luser_relay on linux.example.com.

Set in main.cf

luser_relay = = $user@windows.example.com

http://www.postfix.org/postconf.5.html#luser_relay

If you don't have an MX record for domain windows.example.com and you don't want to create one you can use transport on linux.example.com for it to know where to deliver emails for *@windows.example.com. By default in postfix you have included $myhostname in $mydestination so windows.example.com will accept it.

share|improve this answer
    
The domain will be the exact same for mailboxes on both servers though. It will always be @example.com. So if bob@example.com resides on windows.example.com, postfix needs to forward it on to the windows.example.com machine. But it can't be bob@windows.example.com. It needs to be bob@example.com. Does that make sense? –  Kasius Apr 5 '13 at 13:45
    
The email will be delivered to bob@windows.example.com. But recipient will not be changed. So it will appear as bob@example.com in your email client. Using this windows.example.com subdomain its just a trick to be sure that the email is sent to windows.example.com server. And as I said, if you don't want to define a subdomain in your DNS server you can use transport on linux.example.com for this. –  Laurentiu Roescu Apr 5 '13 at 14:07
    
Fantastic! Creating an MX record should not be a problem for him. Thanks a bunch. –  Kasius Apr 5 '13 at 14:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.