views:

591

answers:

3

Hi,

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?

Thanks!

A: 

Hi

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:

http://howtoforge.org/virtual-users-and-domains-postfix-courier-mysql-centos5.1

or this

http://www.akadia.com/services/postfix_separate_mailboxes.html

Matt

Matt
Those articles only deal with incoming messages.
bmb
A: 

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.

--
bmb

bmb
+1  A: 

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.

Steve Madsen