Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 How can I change my setup so outgoing mails from are being delivered using ip2 interface (so email headers say Received from: and not

share|improve this question
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 <> even if they're sent from 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

Maybe multiple Postfix instances is what you're looking for. Reference:

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

share|improve this answer

Your Answer


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.