Topic: Change SMTP IP - Leave host IP alone

I am having a bit of trouble getting the mail system to use a different IP than apache/server hostname uses and for outgoing mail to use the domain senders domain name not the hostname:

3 IPs bound to server. .22, .23, .24
DNS, server and apache hostname:  www.123.com = xxx.xxx.xxx.22
DNS mail record:  mail.123.com = mail.123.com = xxx.xxx.xxx.23

Apparently I did not get all of the mail config files set as the smtp mail headers contain:

Received: from www.123.com (HELO mail.123.com) ([xxx.xxx.xxx.22])
Received: from localhost (123.com [])
by mail.123.com (iRedMail) with ESMTP id...............
DKIM is for xyx.com
X-Virus-Scanned: amavisd-new at mail.123.com
Received: from mail.123.com ([])
by localhost (www.123.com [])

headers reflect variations of the host name not the senders domain (except DKIM is providing the hosted domains key)
but still reflects xxx.xxx.xxx.22 even though all mail MX records for hostname and hosted domains name point to:  xxx.xxx.xxx.23

1. Which conf files do I set the mail.123.com name in?
2. how can I get mail/smtp outgoing to reflect the hosted domains name not the servers name?
3. how can I get the smtp to use the Ip set in DNWS mx records not the servers IP assigned to apache?

Thank you muchly,


2 (edited by maxie_ro 2010-03-11 17:14:39)

Re: Change SMTP IP - Leave host IP alone

1. You can find out by yourself:

cd /etc
grep -R 'my\.current\.hostname' *

2. I don't think you can set the HELO/EHLO dinamically ever, and besides, you shouldn't. It should just be your hostname, and in a canonical valid form (not "mail.localhost.localdomain" and so on).

3. /etc/postfix/main.cf:
inet_interfaces = xx.xx.xx.xx