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'd like to setup 2 distinct mail services (that look completely separated for end-user) on one machine with 2 IP addresses and 2 domain names. I've started with my current config which is a postfix+dovecot with virtual domains/users using MySQL (it was setup some time ago with an online guide). I've added

localhost:smtp      inet  n       -       -       -       -       smtpd
<ip1 here>:smtp      inet    n       -       -       -       -       smtpd
<ip2 here>:smtp      inet    n       -       -       -       -       smtpd -o myhostname=domain2.com

so when I connect to smtp using another domain name, it has its own banner, but...

Outgoing messages are still delivered with ip address #1 which is rDNSed to domain1.com. How can I change my setup so outgoing mails from domain2.com are being delivered using ip2 interface (so email headers say Received from: domain2.com and not domain1.com)?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

It seems that this is possible using the sender_dependent_default_transport_maps option. Have a look at this page and this.

share|improve this answer
    
It works, but cleanup process doesn't know that there are different myhostnames and all messages have Message-ID header in form of <xxxxxx@domain1.com> even if they're sent from domain2.com. Any ideas how to fix this problem? –  Gepard Dec 28 '11 at 21:58
    
I've fixed it already. The application used own method to send mails via SMTP. I've replaced it with PHPMailer 5.2 and Message-IDs are OK now. –  Gepard Dec 29 '11 at 11:15
    
Nice to hear that! –  Khaled Dec 29 '11 at 11:45
add comment

Maybe multiple Postfix instances is what you're looking for. Reference: http://www.postfix.org/MULTI_INSTANCE_README.html

You can bind two instances to different IP addresses (smtp_bind_address), set different banners (smtpd_banner), etc.

share|improve this answer
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.