Tutorial :Send emails (using Postfix) from two different domains


I have two Ruby on Rails applications, and two virtual domains (mydomain1.com and mydomain2.com)(using Apache+REE+mod_rails). I use Postfix as mail server.

So I have myhostname = mail.mydomain1.com in main.cf And that's because why the sender is always mail.mydomain1.com, no matter from which application I send emails.

I need all emails sent from application on virtual domain mydomain1.com have Received: from mydomain1.com, and from second Rails app on mydomain2.com â€" Received: from mydomain2.com

Is that possible?



Received: headers are added by the receiving server, which is simply doing a reverse DNS lookup on the connecting (sender) IP address. You won't be able to get the result you desire unless you can force Postfix to make its outgoing connections on a specific IP, and then bind an IP per domain to your server.


I guess there is a way to configure Postifx for using virtual accounts for seperate domains. Using this, you should be able to have both of your apps using different settings.

Maybe this helps:


or this




That's a good question, but I don't believe there is an easy answer.

At one point in the past, the author of postfix stated "postfix makes delivery decisions on the basis of the recipient address only. There is no logic for sender-dependent routing." That was years ago but it may still be true.

Some people have tried using two separate instances of Postfix. There's an article here that might help, although I have not examined it that closely.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »