Suppose I have a VPS with multiple dedicated IP addresses and multiple domains:

  • domain-a.com is on, mx is mail.domain-a.com
  • domain-b.com is on, mx is mail.domain-b.com
  • domain-c.com is on, mx is mail.domain-c.com

domain-a.com is the primary domain and the server's hostname is server.domain-a.com

Everything seems to be fine until I find that SMTP emails sent using Exim 4.72 are bouncing, failing or being flagged as spam to many domains. After some digging, I discover that there are mismatches: for emails from every domain, the HELO is from server.domain-a.com.

For example, I see this in headers on emails I send to gmail:

Received: from server.domain-a.com (mail.domain-c.com. [])

And a mail testing service like https://www.mail-tester.com/ tells me:

Your reverse DNS does not match with your sending domain.

Your IP address is associated with the domain mail.domain-c.com.

Nevertheless your message appears to be sent from server.domain-a.com.

You may want to change your pointer (PTR type) DNS record and the host name of your server to the same value.

Here are the tested values for this check:

HELO: server.domain-a.com
rDNS: mail.domain-c.com

But obviously I can't point server.domain-a.com at domains a, b and c at once, and anyway, I don't necessarily want domain-c.com to be sending via domain-a.com - let's assume they're independent businesses that just happen to be hosted on the same server.

How can I configure exim to send each email from its own domain, and to HELO from the mail server domain, not the server's primary hostname?

So that the headers look like this:

Received: from mail.domain-c.com (mail.domain-c.com. [])

And the testing results report this:

HELO: mail.domain-c.com
rDNS: mail.domain-c.com

I found a solution to this same question for IP addresses, which is how I'm sending mail from different IPs, so I'm sure there must be a similar solution for domains.

In my research all I could find was this solution but it depends on cP***l and W*M and a file /etc/mailhelo that only exists in cP***l. It's clearly possible, but that solution depends on some behind the scenes gubbins baked into cP***l, which I don't use.

Operating system is CentOS if that's relevant.

1 Answer 1


Well, that was easier than expected.

I noticed my exim settings file (/etc/exim/exim.conf) contained this commented out line:

#helo_data = $sender_address_domain

Uncommenting it out caused the HELO / from to become the right domain, just missing the mail. prefix.

So what worked for me was:

(1) Under remote_smtp: in my exim config file, which on my system was located at /etc/exim/exim.conf, adding the following line:

helo_data = "mail.${sender_address_domain}"

(2) Restarting exim (on my system, that was service exim restart)

(3) That's all

After making this change, services like Mail Tester find no problems, and this section of my mail headers look normal:

Received: from mail.domain-c.com (mail.domain-c.com. [])

The hostname does still appear later on in the email headers; I've asked a separate question about that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .