I have a mail server that relays e-mails for two different domains. I want the smtp_helo_name to be different based on the domain. I'm assuming there is no way to do this via checking the mail headers, so I was wondering if there was a way to do it by sending mail for one domain to one IP address, and mail for the other to another.

I tried modified master.cf to do this:

localhost:smtp      inet n - n - - smtpd
ip1:smtp inet n - n - - smtpd
ip2:smtp  inet n - n - - smtpd -o myhostnamee=example2.com

And setting smtp_helo_name to $myhostname in main.cf.

I also tried doing -o smtp_helo_name instead, neither work. Any suggestions would be great.

2 Answers 2


This should work (not tried it, though):

Define a separate transport for the other domain and then route mail to this transport using sender_dependent_relayhost_maps option in main.cf.

Something like this:

In 'master.cf':

smtp-other      unix  -       -       n       -       -       smtp
     -o smtp_helo_name=my.other.helo.name

In 'main.cf':

sender_dependent_relayhost_maps = hash:/etc/postfix/relay_maps

In 'relay_maps':

my.other.domain    smtp-other:

And run 'postmap /etc/postfix/relay_maps'

  • Sorry for the delay, I'll try it out.
    – William
    Jun 21, 2010 at 15:23
  • Going to accept this as it answered my question, although I'm going to end up running multiple postfix instances as I'll be handling relay for multiple domains and each will have a unique IP address. There doesn't seem to be a solid way to have postfix know to send e-mail based off what interface was used to receive.
    – William
    Jul 8, 2010 at 21:25
  • Starting multiple smtpd (listening on different interfaces) from one master.cf should work – you would be able to use different smtpd options there and those could probably be propagated to the rest of the Postfix framework. Though, that is just a guess – I would have to think longer about a detailed solution and if it is possible at all. Jul 13, 2010 at 19:33

Take look at Managing multiple Postfix instances on a single host, but be aware that multi-instance support is only available with Postfix version 2.6 and later.

  • Postfix is so flexible, that it is very rarely needed to have more than one instance of it. You can always have multiple instances of most postfix components (configured in master.cf) and that is usually enough for whole lot of scenarios. Mar 12, 2010 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.