Mail sent with the wrong domain

That’s a different “problem”.

Is your server using the right hostname?

Anyway, you can force Exim to use the hostname you want.

First, backup exim conf just in case…

Check what are the directives using lookup dnsdb to get the primary_hostname:

grep '${lookup dnsdb{>: defer_never,ptr=$.*}{${listextract{1}{$value}}}{$primary_hostname}}' /etc/exim4/exim4.conf.template

You should see 3 of them, one smtp_active_hostname and two helo_data. Search them in exim conf file /etc/exim4/exim4.conf.template and just replace their values with your hostname.

smtp_active_hostname = whatever.yourdomain.tld
helo_data = whatever.yourdomain.tld
helo_data = whatever.yourdomain.tld

Save the conf file and restart exim4.

2 Likes