r13
r13

Reputation: 117

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?

Thanks!

Upvotes: 2

Views: 1889

Answers (3)

bmb
bmb

Reputation: 6248

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.

Upvotes: 0

Steve Madsen
Steve Madsen

Reputation: 13791

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.

Upvotes: 1

Matt
Matt

Reputation: 1630

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

Upvotes: 0

Related Questions